Repository navigation
fix(macaq): keep the wide bias through pack and load (#5632) - #5656
Merged
Merged
Conversation
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.
Summary
MACaQ rounded the canonical bias to the compute/activation dtype before the FP32 reduction. An FP32 bias of
-257became-256in BF16, so the packed unit weights'256product no longer cancelled and the layer returned0instead of-1.MacaqLinear.load_quant_resultnow keeps the source bias dtype (replacing the buffer when the dtype differs) instead of copying into acompute_dtypebuffer.MacaqLinear._forward_torchand the W4A16 Triton tail pass the stored bias tolinear_fp32_reduceunchanged, so a wider bias is added after the FP32 reduction and only the final output is rounded.MacaqLinear.MODEL_DTYPE_BUFFERSno longer listsbias: a checkpoint FP32 bias survives a BF16 load instead of being narrowed by accelerate.BH/pre_scalestill follow the model dtype.Tests
tests/test_macaq_wide_bias_5632.py(new): pack path for BF16 and FP32 construction dtypes, a safetensors checkpoint round trip, and the W4A16 Triton tail with an FP32 bias.tests/test_macaq.py,tests/test_macaq_fp32_reduce_4221.py,tests/test_macaq_forward_dtype_4217.py,tests/test_macaq_single_output_4472.py,tests/test_macaq_rotation_serialization_4225.py,tests/test_checkpoint_quant_buffer_dtypes_4458.py: 163 passed.[email protected] check gptqmodel tests: clean.Fixes #5632.