Skip to content

support modelopt W4A16 NVFP4 export for grouped MoE weights#4566

Open
HollowMan6 wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
HollowMan6:modelopt
Open

support modelopt W4A16 NVFP4 export for grouped MoE weights#4566
HollowMan6 wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
HollowMan6:modelopt

Conversation

@HollowMan6

Copy link
Copy Markdown
Member

What does this PR do ?

Support modelopt W4A16 NVFP4 export for grouped MoE weights

Changelog

  • Extend AutoBridge.export_hf_weights_modelopt to support quant_mode="w4a16_nvfp4". NVIDIA/Model-Optimizer@a451a2b
  • Collect ModelOpt quant metadata from the actual quantized weight/module, including NVFP4 weight_scale_2.
  • Map Megatron ModelOpt metadata onto exported HF names before quantization.
  • Support grouped MoE expert exports by syncing EP metadata, stacking per-expert metadata, and emitting vLLM ModelOpt fused-MoE tensor names:
    • *.experts.w13_weight
    • *.experts.w13_weight_scale
    • *.experts.w13_weight_scale_2
    • *.experts.w2_weight
    • *.experts.w2_weight_scale
    • *.experts.w2_weight_scale_2
  • Keep ignored weights unquantized and skip quantizer tensors during export.

GitHub Actions CI

See the CI section in the Contributing doc for how to trigger the CI. A Nvidia developer will need to approve and trigger the CI for external contributors.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

If you haven't finished some of the above items you can still open "Draft" PR.

Additional Information

  • Related to # (issue)

- Extend AutoBridge.export_hf_weights_modelopt to support quant_mode="w4a16_nvfp4".
- Collect ModelOpt quant metadata from the actual quantized weight/module, including NVFP4 weight_scale_2.
- Map Megatron ModelOpt metadata onto exported HF names before quantization.
- Support grouped MoE expert exports by syncing EP metadata, stacking per-expert metadata, and emitting vLLM ModelOpt fused-MoE tensor names:
    - *.experts.w13_weight
    - *.experts.w13_weight_scale
    - *.experts.w13_weight_scale_2
    - *.experts.w2_weight
    - *.experts.w2_weight_scale
    - *.experts.w2_weight_scale_2
- Keep ignored weights unquantized and skip quantizer tensors during export.

Signed-off-by: Hollow Man <hollowman@opensuse.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant