-
Notifications
You must be signed in to change notification settings - Fork 283
add mxfp4 qat, mainly packing code. #2347
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
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.
Pull request overview
This PR adds support for MXFP4 (4-bit microscaling floating point) quantization-aware training (QAT), extending the existing MXFP8 support. The implementation includes packing utilities to convert FP4 values into packed uint8 format and export functionality for serialization.
Key changes:
- Added MXFP4 to QAT module mappings alongside MXFP8
- Implemented FP4 packing/unpacking utilities with bit manipulation
- Extended export logic to handle MXFP4 format with packed weight buffers
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| neural_compressor/torch/quantization/config.py | Adds MXFP4 to QAT module mappings for torch.nn.Linear |
| neural_compressor/torch/export/export_hf.py | Adds MXFP4 export path that packs weights into buffers |
| neural_compressor/torch/algorithms/qat/tensor_quantizer.py | Implements MXFP4 weight packing using new packing utilities |
| neural_compressor/torch/algorithms/qat/quant_utils.py | Adds MXFP4 detection and sets float-quantized format |
| neural_compressor/torch/algorithms/qat/mxfp4_packing.py | New file with FP4 casting and uint4-to-uint8 packing functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
for more information, see https://pre-commit.ci
yiliu30
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.
Please add some UTs.
add ut |
.../pytorch/nlp/huggingface_models/language-modeling/quantization/llm_qat/quantize_autoround.py
Show resolved
Hide resolved
|
Code issue not related to this PR. |
Description
add mxfp4 qat