E5-V icon indicating copy to clipboard operation
E5-V copied to clipboard

Does not work for newer versions of the transformers

Open Howuhh opened this issue 9 months ago • 1 comments

Hi! Seems like the processor is broken for newer versions of the transformers library, it works for 4.44, but not for >=4.52:

inputs = self.processor(
            ^^^^^^^^^^^^^^^
 File "/home/user/conda/lib/python3.11/site-packages/transformers/models/llava_next/processing_llava_next.py", line 167, in __call__
   num_image_tokens = self._get_number_of_features(orig_height, orig_width, height, width)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/user/conda/lib/python3.11/site-packages/transformers/models/llava_next/processing_llava_next.py", line 188, in _get_number_of_features
   patches_height = height // self.patch_size
                    ~~~~~~~^^~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for //: 'int' and 'NoneType'

Difference between versions: working: https://github.com/huggingface/transformers/blob/984bc11b0882ff1e5b34ba717ea357e069ceced9/src/transformers/models/llava_next/processing_llava_next.py

not working: https://github.com/huggingface/transformers/blob/51f94ea06d19a6308c61bbb4dc97c40aabd12bad/src/transformers/models/llava_next/processing_llava_next.py

Is there any quick fix? Maybe via specifying revision for the processor? Thanks!

Howuhh avatar Jul 19 '25 19:07 Howuhh

Hello, it seems this can be a quick fix by just passing the patch_size to the processor. However, I am not sure if this fix is correct (it is recommended to use 4.44).

processor = LlavaNextProcessor.from_pretrained('royokong/e5-v')
processor.patch_size = 14

kongds avatar Jul 21 '25 03:07 kongds