Skip to content

Commit

Permalink
Fix unbounded variables issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yonigozlan committed Jul 26, 2024
1 parent 469f825 commit 116ea57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transformers/models/idefics/processing_idefics.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __call__(
padding: Union[bool, str, PaddingStrategy] = False,
truncation: Union[bool, str, TruncationStrategy] = None,
max_length: Optional[int] = None,
return_tensors: Optional[Union[str, TensorType]] = None,
return_tensors: Optional[Union[str, TensorType]] = "pt",
legacy=True,
prompts: Optional[Union[List[TextInput], List[List[TextInput]]]] = None,
transform: Callable = None,
Expand Down
2 changes: 2 additions & 0 deletions src/transformers/pipelines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,8 @@ def get_iterator(
feature_extractor = self.image_processor
elif self.processor is not None:
feature_extractor = self.processor
else:
feature_extractor = None
collate_fn = no_collate_fn if batch_size == 1 else pad_collate_fn(self.tokenizer, feature_extractor)
dataloader = DataLoader(dataset, num_workers=num_workers, batch_size=batch_size, collate_fn=collate_fn)
model_iterator = PipelineIterator(dataloader, self.forward, forward_params, loader_batch_size=batch_size)
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/pipelines/image_text_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def count_images_in_chat(chat):
@add_end_docstrings(build_pipeline_init_args(has_processor=True))
class ImageTextToTextPipeline(Pipeline):
"""
Image-text-to-text pipeline. This pipeline generates text given an image and text.
Image-text-to-text pipeline using an `AutoModelForImageTextToText`. This pipeline generates text given an image and text.
Example:
Expand Down

0 comments on commit 116ea57

Please sign in to comment.