Fix: propagate quantization_config to text sub-config for composite models in AutoModelForCausalLM#45494
Merged
SunMarc merged 2 commits intohuggingface:mainfrom Apr 21, 2026
Conversation
9 tasks
Member
|
cc @SunMarc for quants |
SunMarc
reviewed
Apr 20, 2026
Member
SunMarc
left a comment
There was a problem hiding this comment.
Thanks a lot ! Left a suggestion and a comment
…odels in AutoModelForCausalLM Signed-off-by: lvliang-intel <liang1.lv@intel.com>
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
aaf3b31 to
c9981a2
Compare
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: auto |
|
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. |
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 loading of quantized composite models (e.g. Qwen3.5-35B-A3B with AutoRound quantization) via AutoModelForCausalLM.from_pretrained.
Problem:
For composite models whose model_class.config_class maps to text_config, the from_pretrained method in auto_factory.py swaps the full composite config with the text sub-config:
The quantization_config is stored on the top-level composite config (from config.json), but not on the text sub-config. When modeling_utils.py later calls get_hf_quantizer, it checks hasattr(config, "quantization_config") to determine pre_quantized. Since the text sub-config lacks this attribute, pre_quantized is set to False, which causes a ValueError for quantization methods that require pre-quantized weights (e.g. AutoRound, GPTQ, AWQ).
How to reproduce the issue:
Fixes # (issue)
After swapping to the text sub-config, propagate quantization_config from the parent composite config if it exists and the text sub-config does not already have one.