Question about generate method for AutoModelForCausalLM

I am trying to use the git model from the pretrained to pass to captum API for calculation of the attribution score.


Initialize the attribution algorithm

from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(“microsoft/git-base”)
ig = IntegratedGradients(model)

However, in order for the IG algorithm to work, the “model” should be the forward function of the model.
I need to understand how the output of the model
outputs = model(input_ids=training_batch["input_ids"], attention_mask=training_batch["attention_mask"], pixel_values=training_batch["pixel_values"], labels=training_batch["input_ids"])
corresponds with output of the generate method generated_ids = model.generate(pixel_values=pixel_values, max_length=80)