Skip to content

Commit

Permalink
Add generate kwargs to VQA pipeline (#29134)
Browse files Browse the repository at this point in the history
  • Loading branch information
regisss authored Feb 27, 2024
1 parent 871ba71 commit a3f9221
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transformers/pipelines/visual_question_answering.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def preprocess(self, inputs, padding=False, truncation=False, timeout=None):
model_inputs.update(image_features)
return model_inputs

def _forward(self, model_inputs):
def _forward(self, model_inputs, **generate_kwargs):
if self.model.can_generate():
model_outputs = self.model.generate(**model_inputs)
model_outputs = self.model.generate(**model_inputs, **generate_kwargs)
else:
model_outputs = self.model(**model_inputs)
return model_outputs
Expand Down

0 comments on commit a3f9221

Please sign in to comment.