We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformers
@amyeroberts @qubvel @zucchini-nlp
examples
When I was running the following code:
# ignore imports... checkpoint = "HuggingFaceM4/idefics-9b-instruct" model = IdeficsForVisionText2Text.from_pretrained(checkpoint, torch_dtype=torch.bfloat16).to(device) processor = AutoProcessor.from_pretrained(checkpoint) images = [ PIL.Image.open(...), PIL.Image.open(...), ] batched_text = ["<image><image>", "<image><image>"] batched_image = [images, images] processor(batched_image, batched_text)
I got the following exception:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[4], line 5 3 batched_text = ["<image><image>", "<image><image>"] 4 batched_images = [images, images] ----> 5 processor(batched_images, batched_text) File ~/miniconda3/envs/icl/lib/python3.13/site-packages/transformers/utils/deprecation.py:165, in deprecate_kwarg.<locals>.wrapper.<locals>.wrapped_func(*args, **kwargs) 161 elif minimum_action in (Action.NOTIFY, Action.NOTIFY_ALWAYS): 162 # DeprecationWarning is ignored by default, so we use FutureWarning instead 163 warnings.warn(message, FutureWarning, stacklevel=2) --> 165 return func(*args, **kwargs) File ~/miniconda3/envs/icl/lib/python3.13/site-packages/transformers/models/idefics/processing_idefics.py:430, in IdeficsProcessor.__call__(self, images, text, audio, videos, **kwargs) 427 if add_eos_token: 428 full_text += self.tokenizer.eos_token --> 430 image_objects = self.image_processor(image_objects, **output_kwargs["images_kwargs"]) 432 all_prompts.append(full_text) 433 all_images.append(image_objects) File ~/miniconda3/envs/icl/lib/python3.13/site-packages/transformers/image_processing_utils.py:41, in BaseImageProcessor.__call__(self, images, **kwargs) 39 def __call__(self, images, **kwargs) -> BatchFeature: 40 """Preprocess an image or a batch of images.""" ---> 41 return self.preprocess(images, **kwargs) File ~/miniconda3/envs/icl/lib/python3.13/site-packages/transformers/models/idefics/image_processing_idefics.py:134, in IdeficsImageProcessor.preprocess(self, images, image_num_channels, image_size, image_mean, image_std, transform, return_tensors, **kwargs) 131 if isinstance(images, list) and len(images) == 0: 132 return [] --> 134 images = make_list_of_images(images) 136 if not valid_images(images): 137 raise ValueError( 138 "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, " 139 "torch.Tensor, tf.Tensor or jax.ndarray." 140 ) File ~/miniconda3/envs/icl/lib/python3.13/site-packages/transformers/image_utils.py:206, in make_list_of_images(images, expected_ndims) 201 raise ValueError( 202 f"Invalid image shape. Expected either {expected_ndims + 1} or {expected_ndims} dimensions, but got" 203 f" {images.ndim} dimensions." 204 ) 205 return images --> 206 raise ValueError( 207 "Invalid image type. Expected either PIL.Image.Image, numpy.ndarray, torch.Tensor, tf.Tensor or " 208 f"jax.ndarray, but got {type(images)}." 209 ) ValueError: Invalid image type. Expected either PIL.Image.Image, numpy.ndarray, torch.Tensor, tf.Tensor or jax.ndarray, but got <class 'list'>.
Note that this bug is not exist in v4.45.2.
Even I have followed instruction provided here, I still got such a bug, why?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
System Info
transformers
version: 4.47.1Who can help?
@amyeroberts @qubvel @zucchini-nlp
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
When I was running the following code:
I got the following exception:
Note that this bug is not exist in v4.45.2.
Expected behavior
Even I have followed instruction provided here, I still got such a bug, why?
The text was updated successfully, but these errors were encountered: