Repository navigation
feat(quantization): support float16 scale_dtype - #169
Open
dengqiaoyu wants to merge 1 commit into
Open
dengqiaoyu wants to merge 1 commit into
dengqiaoyu wants to merge 1 commit into
Conversation
dengqiaoyu
force-pushed
the
feat/float16-scale-dtype
branch
from
October 28, 2026 00:27
c61f297 to
2fb91fa
Compare
- Add `scale_dtype=torch.float16`: each scale is computed in at least fp32, clamped to the FP16 max and rounded to FP16 whatever the model dtype, and an asymmetric zero point is recomputed from the rounded scale - Accept it on integer and FP8 specs; FP4 still requires e8m0 scales, and palettization rejects it for `lut_qspec` - Raise `NotImplementedError` from `Quantizer.finalize` for CoreAI and CoreML, since export stores each scale at the model dtype instead of FP16 - Raise `RuntimeError` when a cached scale buffer cannot hold FP16 values exactly: a bf16 `torch.set_default_dtype` during `prepare`, or a bf16 cast of the prepared model - Count FP16 scales at 16 bits in `bits_per_weight`
dengqiaoyu
force-pushed
the
feat/float16-scale-dtype
branch
from
October 29, 2026 00:36
2fb91fa to
17a3233
Compare
This branch has not been deployed
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.
scale_dtype=torch.float16: each scale is computed in at least fp32, clamped to the FP16 max and rounded to FP16 whatever the model dtype, and an asymmetric zero point is recomputed from the rounded scalelut_qspecNotImplementedErrorfromQuantizer.finalizefor CoreAI and CoreML, since export stores each scale at the model dtype instead of FP16RuntimeErrorwhen a cached scale buffer cannot hold FP16 values exactly: a bf16torch.set_default_dtypeduringprepare, or a bf16 cast of the prepared modelbits_per_weight