Fix _init_weights to safely skip int8 tensors in Qwen2_5_VL model - #41490
Open
KaparthyReddy wants to merge 8 commits into
Open
Fix _init_weights to safely skip int8 tensors in Qwen2_5_VL model#41490KaparthyReddy wants to merge 8 commits into
KaparthyReddy wants to merge 8 commits into
Conversation
Member
|
cc @MekkCyber for quantization! |
MekkCyber
reviewed
Oct 10, 2025
MekkCyber
left a comment
Contributor
There was a problem hiding this comment.
Thanks @KaparthyReddy ! I think this the wrong commit
Author
|
Thanks for the feedback! I’ve updated the PR to modify the correct file under src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py. _init_weights now safely skips int8 tensors while initializing float tensors correctly. |
added 4 commits
October 10, 2025 21:41
…Reddy/hf-transformers-contributions into fix-llmcompressor-error the commit.
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: qwen2_5_vl |
ArthurZucker
left a comment
Collaborator
There was a problem hiding this comment.
Hey sorry we merged a big refacto in #41580 !
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.
Summary
This PR fixes the
_init_weights()method inQwen2_5_VLForConditionalGenerationto safely skip int8 tensors during initialization. Previously, applyingnormal_()on int8 weights caused a RuntimeError when loading quantized models.Changes
_init_weights()to only initialize floating-point tensors (float16,float32,bfloat16).Motivation
Quantized models (W8A8, int8 weights) could not be loaded directly due to the previous
_init_weights()implementation. This fix allows smooth loading without RuntimeError, making contributions compatible with LLMCompressor quantized models.Verification
_init_weights()safely ignores int8 tensors.