Repository navigation
Save dequantized models without the quantizer's weight conversions - #50271
Conversation
|
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. |
| if hasattr(model, "quantization_method"): | ||
| del model.quantization_method | ||
| if hasattr(model, "_weight_conversions"): | ||
| del model._weight_conversions |
There was a problem hiding this comment.
are these only the quantizer's weight conversions ?
There was a problem hiding this comment.
This will work in most cases but not for models that we load with transformers format but have weight conversions for the original format. We try to tackle this in #49774.
However, maybe as a temporary fix, I don't mind having this as right now as support for the original format is much more important.
SunMarc
left a comment
There was a problem hiding this comment.
Thanks a lot ! Maybe @ArthurZucker have some feedback on this as it concerns weight conversion.
| if hasattr(model, "quantization_method"): | ||
| del model.quantization_method | ||
| if hasattr(model, "_weight_conversions"): | ||
| del model._weight_conversions |
There was a problem hiding this comment.
This will work in most cases but not for models that we load with transformers format but have weight conversions for the original format. We try to tackle this in #49774.
However, maybe as a temporary fix, I don't mind having this as right now as support for the original format is much more important.
Thanks, agreed: #49774 covers that case, and this is the stop-gap until it lands. @ArthurZucker fine to merge it as such? |
ArthurZucker
left a comment
There was a problem hiding this comment.
Agree with @SunMarc
|
[For maintainers] Suggested jobs to run (before merge) run-slow: finegrained_fp8, mxfp4 |
What does this PR do?
Fixes #50270
A model loaded with
dequantize=Truedrops its quantization config but keeps the quantizer's weight conversions, whichsave_pretrainedreverses. MXFP4 then saves the bf16 experts under*_blocks, and FP8 saves re-quantized weights with noquantization_config, so neither reloads correctly.remove_quantization_confignow also drops the conversions the model was loaded with, so a dequantized model saves like an unquantized one, with the conversions of its class. #49774 adds an opt-in hook for this; here it holds for every quantizer.Tested on H100: the repro from #50270 and an FP8 Mistral3 checkpoint now reload to identical logits (the FP8 one was off by up to 1600). Both new tests fail without the fix.
Who can review?
@SunMarc @MekkCyber @IlyasMoutawwakil