Skip to content

Commit

Permalink
Update src/transformers/models/idefics3/processing_idefics3.py
Browse files Browse the repository at this point in the history
Co-authored-by: Yoni Gozlan <[email protected]>
  • Loading branch information
mfarre and yonigozlan authored Dec 20, 2024
1 parent f994edc commit f83689c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/transformers/models/idefics3/processing_idefics3.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ def __call__(
inputs.update(text_inputs)

elif text is not None:
if any(n_images_in_text):
raise ValueError(
f"Found {sum(n_images_in_text)} {self.image_token.content} tokens in the text but no images were passed."
)
text_inputs = self.tokenizer(text=text, **output_kwargs["text_kwargs"])
inputs.update(text_inputs)

Expand Down

0 comments on commit f83689c

Please sign in to comment.