Repository navigation
Qwen2.5-Omni: Update modeling_qwen2_5_omni.py to fix error when loading quantized weights with AutoAWQ. - #38013
Merged
Merged
Conversation
fix the error when loading quantized model by AuotAWQ.
Contributor
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
sync code to modular_qwen2_5_omni.py
tiger-of-shawn
marked this pull request as ready for review
May 8, 2025 10:41
Contributor
Author
|
@MekkCyber here is the new PR to fix CI error. |
MekkCyber
approved these changes
May 8, 2025
MekkCyber
left a comment
Contributor
There was a problem hiding this comment.
Sounds good ! Pinging @Cyrilvallez since he worked on _init_weights recently
Contributor
Author
|
Could you please review this PR @ArthurZucker @Rocketknight1 , thank you very much. |
ArthurZucker
approved these changes
May 20, 2025
ArthurZucker
left a comment
Collaborator
There was a problem hiding this comment.
For sure! sorry for the delayed review, thanks 🤗
faaany
pushed a commit
to faaany/transformers
that referenced
this pull request
May 21, 2025
…ng quantized weights with AutoAWQ. (huggingface#38013) * Update modular_qwen2_5_omni.py fix the error when loading quantized model by AuotAWQ. * Update modeling_qwen2_5_omni.py sync code to modular_qwen2_5_omni.py
xvyv99
pushed a commit
to xvyv99/transformers
that referenced
this pull request
May 21, 2025
…ng quantized weights with AutoAWQ. (huggingface#38013) * Update modular_qwen2_5_omni.py fix the error when loading quantized model by AuotAWQ. * Update modeling_qwen2_5_omni.py sync code to modular_qwen2_5_omni.py
This was referenced Aug 12, 2026
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.
Qwen2.5-Omni: Update modeling_qwen2_5_omni.py to fix loading quantized weights with AutoAWQ.
What does this PR do?
while loading AWQ quantized Qwen-Omni model with AutoAWQ, there will be an error as below:
Traceback (most recent call last):
File "/nas/yuehu/NEW/AutoAWQ/./examples/quantize_qwen_omni.py", line 188, in
inference_quantized_model(quant_path)
File "/nas/yuehu/NEW/AutoAWQ/./examples/quantize_qwen_omni.py", line 123, in inference_quantized_model
model = AutoAWQForCausalLM.from_quantized(quant_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nas/yuehu/NEW/AutoAWQ/awq/models/auto.py", line 125, in from_quantized
return AWQ_CAUSAL_LM_MODEL_MAP[model_type].from_quantized(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nas/yuehu/NEW/AutoAWQ/awq/models/base.py", line 498, in from_quantized
model = target_cls.from_config(
^^^^^^^^^^^^^^^^^^^^^^^
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 440, in from_config
return model_class._from_config(config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 280, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2023, in _from_config
model = cls(config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py", line 4386, in init
self.post_init()
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 1886, in post_init
self.init_weights()
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 3149, in init_weights
self.initialize_weights()
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2502, in initialize_weights
self.smart_apply(self._initialize_weights)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2493, in smart_apply
module.smart_apply(module._initialize_weights)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2493, in smart_apply
module.smart_apply(module._initialize_weights)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2495, in smart_apply
module.smart_apply(fn)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2495, in smart_apply
module.smart_apply(fn)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2495, in smart_apply
module.smart_apply(fn)
[Previous line repeated 1 more time]
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2496, in smart_apply
fn(self)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/modeling_utils.py", line 2470, in _initialize_weights
self._init_weights(module)
File "/root/anaconda3/envs/awq/lib/python3.12/site-packages/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py", line 152, in init_weights
module.weight.data.fill(1.0)
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'
Fixes # (issue)
this PR can fix the above error.
Who can review?
@ArthurZucker @amyeroberts @qubvel
thanks for your reviewing.