[Bugfix][Quantization][MoE] Route weight only NVFP4 checkpoints through W4A16 (#54427)
Signed-off-by: Aditya Jha <4adityajha@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1081,6 +1081,22 @@ class ModelOptNvFp4Config(ModelOptQuantConfigBase):
|
||||
) -> "ModelOptNvFp4Config":
|
||||
is_checkpoint_nvfp4_serialized = "NVFP4" in quant_method
|
||||
|
||||
# A checkpoint can declare quant_algo "NVFP4" yet quantize weights
|
||||
# only (input_activations is null in every config group). The W4A4
|
||||
# MoE path then folds an uninitialized input_scale that was never
|
||||
# loaded and can zero every expert, so route it through W4A16.
|
||||
if quant_method == "NVFP4":
|
||||
config_groups = original_config.get("config_groups")
|
||||
if (
|
||||
isinstance(config_groups, dict)
|
||||
and config_groups
|
||||
and all(
|
||||
isinstance(group, dict) and group.get("input_activations") is None
|
||||
for group in config_groups.values()
|
||||
)
|
||||
):
|
||||
quant_method = "W4A16_NVFP4"
|
||||
|
||||
if group_size is None:
|
||||
group_size = 16 # Default value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user