-
Notifications
You must be signed in to change notification settings - Fork 213
Kimi-k2 calib+export #655
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
base: main
Are you sure you want to change the base?
Kimi-k2 calib+export #655
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,7 @@ | |
| "w4a8_nvfp4_fp8": mtq.W4A8_NVFP4_FP8_CFG, | ||
| "w4a8_mxfp4_fp8": mtq.W4A8_MXFP4_FP8_CFG, | ||
| "nvfp4_mlp_only": mtq.NVFP4_MLP_ONLY_CFG, | ||
| "nvfp4_mlp_experts_only": mtq.NVFP4_MLP_EXPERTS_ONLY_CFG, | ||
|
||
| } | ||
|
|
||
| KV_QUANT_CFG_CHOICES = { | ||
|
|
@@ -121,6 +122,7 @@ def auto_quantize( | |
| "fp8_pb_wo", | ||
| "w4a8_mxfp4_fp8", | ||
| "nvfp4_mlp_only", | ||
| "nvfp4_mlp_exports_only", | ||
jingyu-ml marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ] | ||
| for qformat in qformat_list | ||
| ), "One or more quantization formats provided are not supported for unified checkpoint export" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -623,6 +623,25 @@ | |||||||||||||||||||||||||||||||||||||
| "algorithm": "max", | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| NVFP4_MLP_EXPERTS_ONLY_CFG = { | ||||||||||||||||||||||||||||||||||||||
| "quant_cfg": { | ||||||||||||||||||||||||||||||||||||||
| "*mlp.experts*weight_quantizer": { | ||||||||||||||||||||||||||||||||||||||
| "num_bits": (2, 1), | ||||||||||||||||||||||||||||||||||||||
| "block_sizes": {-1: 16, "type": "dynamic", "scale_bits": (4, 3)}, | ||||||||||||||||||||||||||||||||||||||
| "enable": True, | ||||||||||||||||||||||||||||||||||||||
| "pass_through_bwd": True, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "*mlp.experts*input_quantizer": { | ||||||||||||||||||||||||||||||||||||||
| "num_bits": (2, 1), | ||||||||||||||||||||||||||||||||||||||
| "block_sizes": {-1: 16, "type": "dynamic", "scale_bits": (4, 3)}, | ||||||||||||||||||||||||||||||||||||||
| "enable": True, | ||||||||||||||||||||||||||||||||||||||
| "pass_through_bwd": True, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| **_default_disabled_quantizer_cfg, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "algorithm": "max", | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| NVFP4_MLP_EXPERTS_ONLY_CFG = { | |
| "quant_cfg": { | |
| "*mlp.experts*weight_quantizer": { | |
| "num_bits": (2, 1), | |
| "block_sizes": {-1: 16, "type": "dynamic", "scale_bits": (4, 3)}, | |
| "enable": True, | |
| "pass_through_bwd": True, | |
| }, | |
| "*mlp.experts*input_quantizer": { | |
| "num_bits": (2, 1), | |
| "block_sizes": {-1: 16, "type": "dynamic", "scale_bits": (4, 3)}, | |
| "enable": True, | |
| "pass_through_bwd": True, | |
| }, | |
| **_default_disabled_quantizer_cfg, | |
| }, | |
| "algorithm": "max", | |
| } |
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.
that will quantize mlp.shared_experts
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.
this is great. Let's not creating more cfgs
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.
Is it a recommendation or it's something we have to do? An alterantive is to up cast the in4 to BF16 during calibration like we did with DS.
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.
But there’s no INT4 support in PyTorch, as we discussed. People have to use vLLM if they want INT4. Me and Zhiyu are looking into the vLLM calibration of this model