Skip to content

Conversation

@yonigozlan
Copy link
Member

What does this PR do?

  • Add support for using custom images kwargs in Qwen2VL and Qwen2.5VL processors

  • Fix issue where self.size dict is mutated by a processor call in qwen2vl image processors

  • Add tests for both these issues

Cc @hmellor @ArthurZucker

@github-actions
Copy link
Contributor

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the Ready for review button (at the bottom of the PR page).

@github-actions github-actions bot marked this pull request as draft March 21, 2025 17:52
@yonigozlan yonigozlan marked this pull request as ready for review March 21, 2025 17:52
@github-actions github-actions bot requested review from qubvel and ydshieh March 21, 2025 17:53
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ManuelFay
Copy link
Contributor

Ah great, I was banging my head with this !

Copy link
Contributor

@qubvel qubvel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks for fixing!

min_pixels = size["shortest_edge"]
else:
size = self.size
size = {**self.size}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
size = {**self.size}
size = self.size.copy()

min_pixels = size["shortest_edge"]
else:
size = self.size
size = {**self.size}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
size = {**self.size}
size = self.size.copy()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah missed this comment sorry, will fix in a later PR

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM waiting for comments to be adressed

@yonigozlan yonigozlan merged commit 91455c1 into huggingface:main Mar 24, 2025
23 checks passed
@yonigozlan yonigozlan added the for patch Tag issues / labels that should be included in the next patch label Mar 25, 2025
ArthurZucker pushed a commit that referenced this pull request Mar 26, 2025
* Fix qwen2_vl and qwen2_5_vl processors cutom images kwargs

* change version warning
@ErykCh
Copy link

ErykCh commented Mar 28, 2025

This changes result in error in newest vllm 0.8.2
when loading UI-TARS

docker run --runtime nvidia --gpus all -d --name vllm-UI-Tars-7b --restart unless-stopped -v ~/.cache/huggingface:/root/.cache/huggingface -e VLLM_USE_V1=0 -p 8000:8000 vllm/vllm-openai:v0.8.2 --model bytedance-research/UI-TARS-7B-DPO --served-model-name llm --trust-remote-code

error is:
File "/usr/local/lib/python3.12/dist-packages/transformers/models/qwen2_vl/image_processing_qwen2_vl.py", line 144, in init
ERROR 03-28 00:22:29 [engine.py:448] raise ValueError("size must contain 'shortest_edge' and 'longest_edge' keys.")

@ArthurZucker
Copy link
Collaborator

Arf, happy to fix cc @hmellor !

@hmellor
Copy link
Member

hmellor commented Mar 31, 2025

vLLM 0.8.2 uses Transformers 4.48.2, this PR is not present in that release.

Your command doesn't indicate that you're using a custom image, so I'm not sure how you're seeing an error caused by this PR @ErykCh?

zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request May 14, 2025
* Fix qwen2_vl and qwen2_5_vl processors cutom images kwargs

* change version warning
soghomon-b pushed a commit to soghomon-b/transformers that referenced this pull request Aug 24, 2025
* Fix qwen2_vl and qwen2_5_vl processors cutom images kwargs

* change version warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

for patch Tag issues / labels that should be included in the next patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants