[Qwen2VL] Fix missing min_pixels/max_pixels attributes in fast image processor#43548
Closed
tomaszcichy98 wants to merge 1 commit intohuggingface:mainfrom
Closed
Conversation
…processor The fast image processor converts min_pixels/max_pixels to size dict entries but doesn't set them as instance attributes. This breaks compatibility with code that expects these attributes (e.g., vLLM). The slow processor (Qwen2VLImageProcessor) sets these attributes, but the fast processor (Qwen2VLImageProcessorFast) only sets self.size. This causes vLLM to fail with: TypeError: '>' not supported between instances of 'int' and 'NoneType' Fix by setting min_pixels/max_pixels attributes after super().__init__().
4f0a445 to
7ce8dab
Compare
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: glm_image, qwen2_vl, video_llama_3 |
Member
|
cc @zucchini-nlp maybe? |
Member
|
fyi @hmellor ,can be added in vllm-project/vllm#30566 if it's indeed not working |
Contributor
Author
Yeah it is coming from vLLM @zucchini-nlp |
Member
|
This is already fixed in vLLM vllm-project/vllm#33208 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a bug where
Qwen2VLImageProcessorFastdoesn't setmin_pixelsandmax_pixelsinstance attributes, breaking compatibility with code that expects these attributes.The Problem
The slow processor (
Qwen2VLImageProcessor) setsself.min_pixelsandself.max_pixelsas instance attributes. The fast processor converts these tosize["shortest_edge"]andsize["longest_edge"]but never sets the original attributes.This causes vLLM (and potentially other libraries) to fail when loading Qwen2-VL/Qwen2.5-Omni models:
Why config values don't help
Even if
preprocessor_config.jsoncontainsmin_pixelsandmax_pixelsvalues, this doesn't fix the issue because:use_fast: falsein the config is ignored - transformers 5.0 always auto-upgrades to the fast processorself.sizedict, not as instance attributesprocessor.min_pixelsgetsNoneinstead of the config valueThe Fix
Set
min_pixelsandmax_pixelsattributes aftersuper().__init__()to maintain backward compatibility:Verification