Fix bnb 4bit/8bit quantization drop chunked tensors bug#46210
Merged
Conversation
… load Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
SunMarc
approved these changes
May 27, 2026
Member
SunMarc
left a comment
There was a problem hiding this comment.
Nice, thanks a lot for this !
|
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. |
yuchenxie4645
pushed a commit
to yuchenxie4645/transformers
that referenced
this pull request
May 28, 2026
…46210) Fix bnb 4bit/8bit quantization dropping chunked tensors during weight load Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
kashif
pushed a commit
to kashif/transformers
that referenced
this pull request
Jun 1, 2026
…46210) Fix bnb 4bit/8bit quantization dropping chunked tensors during weight load Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
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?
Bnb4bitQuantize.convert/Bnb8bitQuantize.convertonly quantized the first entry ofinput_dictand returned{full_layer_name: value}, silently dropping any extra tensors produced by an upstream one-to-manyWeightConverter(e.g. aChunkop splitting a fused weight). Those targets were never loaded, kept their random init,and thus trigger the assert Error:assert module.weight.shape[1] == 1.Fix:
iterate over every
(param_name, value)ininput_dictand quantize each one against its own module.Repro
hrm_text is affected because it chunks attn.gqkv_proj → gate_proj/q_proj/k_proj/v_proj and mlp.gate_up_proj → gate_proj/up_proj
on load. Without the fix, q/k/v_proj and mlp.up_proj show up as MISSING in the load report and the 4bit forward asserts.
The case passes after this fix.
Who can review?
@SunMarc pls help review, thx!