-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Fixes hqq by following a new path for bias parameter in pre_quantized models #37530
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
Conversation
|
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 |
SunMarc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM ! Let's add a small test if this isn't tested
|
Thank you @MekkCyber. Can you also change this: |
|
we already have this test : https://github.com/huggingface/transformers/blob/main/tests/quantization/hqq/test_hqq.py#L151, we just need to add the pre_quantized case |
|
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. |
It doesn't check for serialization of a model with a bias. If it did, the tests would have failed actually |
|
Can you please run this script: If it doesn't throw an error, the fix works as expected. |
yep that's what i meant, we only need to add the case of pre_quantized (serialized) models |
|
The snippet works well |
|
Awesome, thank you again @MekkCyber 🙏 |
… models (huggingface#37530) * fix * add test
|
@MekkCyber unfortunately it seems that it's not fully resolved. For example, when I tried to load a quantized Qwen model that has a bias: import torch
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
model_id = "mobiuslabsgmbh/Qwen2.5-VL-3B-Instruct_4bitgs64_hqq_hf"
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_id, torch_dtype=torch.float16, device_map="cuda:0") |
|
Thanks for reporting @mobicham, will take a look |
… models (huggingface#37530) * fix * add test
What does this PR do?
Since HQQ overrides the
load_state_dictmethod forHQQLinear, it directly loads both the weight and bias parameters. This differs from our approach, where we iterate through the parameters one by one and load the bias separately from the weights.This PR updates the behavior to simply ignore the bias parameter, assuming it was already loaded alongside the weights in the case of pre-quantized models.