Skip to content

Potential bug in Qwen 2/2.5 VL Image Preprocessor #38003

New issue

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

Closed
ritwickchaudhry opened this issue May 7, 2025 · 6 comments · Fixed by #38076
Closed

Potential bug in Qwen 2/2.5 VL Image Preprocessor #38003

ritwickchaudhry opened this issue May 7, 2025 · 6 comments · Fixed by #38076

Comments

@ritwickchaudhry
Copy link
Contributor

repeats = np.repeat(patches[-1][np.newaxis], temporal_patch_size - 1, axis=0)

The temporal_patch_size is used to group consecutive video frames. However, if the number of frames are not divisible, then the last frame is repeated. The current number of repetitions is temporal_patch_size - 1. While this will work for temporal_patch_size = 2 but it wouldn't work for larger patch sizes.

In my opinion, the code should be modified to:

repeats = np.repeat(patches[-1][np.newaxis], temporal_patch_size - (patches.shape[0] % temporal_patch_size), axis=0)
@zucchini-nlp
Copy link
Member

zucchini-nlp commented May 8, 2025

@ritwickchaudhry correct! There was another issue with PR somewhere (#37350), probably got stale. I have forgot about it due to low priority. Would you like to open a PR for this?

LMK if you can't contribute, I can finalize and merge the existing PR later next week :)

@ritwickchaudhry
Copy link
Contributor Author

Thanks @zucchini-nlp ! Sure, let me create a PR soon!

@anshulsc
Copy link

Hi @ritwickchaudhry and @zucchini-nlp,

I've also encountered this issue and have implemented the fix based on the discussion here.
@ritwickchaudhry, I saw you mentioned you'd be creating a PR. Are you still planning to, or would you mind if I submit one with the changes?

@ritwickchaudhry
Copy link
Contributor Author

@anshulsc I'll be releasing the PR very soon, as I finished most of it. Thanks for the offer though!

@anshulsc
Copy link

@ritwickchaudhry great !!

@ritwickchaudhry
Copy link
Contributor Author

Done actually! @zucchini-nlp can you please review the PR: #38076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants