Repository navigation
Fix layerwise MoE source-weight accounting (NVBug 6954041) - #2876
Conversation
Signed-off-by: weimingc <[email protected]>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2876 +/- ##
==========================================
+ Coverage 76.99% 77.94% +0.94%
==========================================
Files 658 658
Lines 73950 75760 +1810
==========================================
+ Hits 56939 59051 +2112
+ Misses 17011 16709 -302
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cjluo-nv
left a comment
There was a problem hiding this comment.
Bot review (bedrock-claude-opus-5-5) — DM the bot to share feedback.
LGTM: the fix is small and correct. It snapshots the unplaced source keys in bind(), before per-layer packing removes the fused expert parameters, and then reuses that snapshot for the same checkpoint. Human sign-off is still needed because an existing test was edited, for a justified reason.
Needs action:
- Confirm that the edit to
test_moe_export_matchesintests/gpu/torch/export/test_layerwise_export.pyis acceptable, and that the GPU CI job passes. The author only ran a CPU adaptation of this test, not the committed CUDA version. The edit is justified: the test now goes throughexport_hf_checkpointwith a real source checkpoint, and every original assertion is kept.
No action needed:
- The local import in
unplaced_keys_foris justified: it breaks a circular import, andexport_hf_checkpointalready importsLAYERWISE_EXPORTER_ATTRthe same way. - The snapshot is matched against
str(ckpt), and every caller passes_source_checkpoint(model), so the two values always agree. A different checkpoint, or an exporter that was never bound, falls through to the existing logic, so whole-model export is unchanged. read_unplaced_weightsruns beforefinalize()detaches the exporter, so the snapshot is still reachable when it's needed.- Minor:
unplaced_keys_forreads the exporter's private_source_key_snapshotattribute. That's acceptable at this size, but a small accessor method would make the coupling explicit.
#2928 #2885 #2908 #2929 #2950 #2972 #2877 #2951 #2816 #3005 #3012 #2971 #3015 #3006 #3026 #2988 #3028 #1860 #3030 #2612 #3033 #2653 #2599 #2655 #2618 #2868 #3032 #3027 #2869 #2984 #2975 #2345 #3020 #2997 (#3072) ## Cherry-picked PRs - #2817 - #2671 - #2892 - #2876 - #2910 - #2911 - #2919 - #2904 - #2937 - #2928 - #2885 - #2908 - #2929 - #2950 - #2972 - #2877 - #2951 - #2816 - #3005 - #3012 - #2971 - #3015 - #3006 - #3026 - #2988 - #3028 - #1860 - #3030 - #2612 - #3033 - #2653 - #2599 - #2655 - #2618 - #2868 - #3032 - #3027 - #2869 - #2984 - #2975 - #2345 - #3020 - #2997 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Diffusion exports now offer more control over attention-quantizer metadata and preserve sparse-attention settings in a format compatible with downstream tooling. * Model loading better handles select bundled model implementations, and Docker guidance now covers writable CUDA-extension cache locations. * **Bug Fixes** * Improved reliability for model export and checkpoint saving, quantization across devices, ONNX processing, and calibration. * Temporary TensorRT and autotuning artifacts now use private directories by default. * **Documentation** * Updated installation guidance, compatibility notes, and links; corrected typos across guides and examples. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Chad Voegele <[email protected]> Signed-off-by: Rohan Joshi <[email protected]> Signed-off-by: LinCanNerd <[email protected]> Signed-off-by: Keval Morabia <[email protected]> Signed-off-by: weimingc <[email protected]> Signed-off-by: Noey Yang <[email protected]> Signed-off-by: Kai Xu <[email protected]> Signed-off-by: Zhehao Hu <[email protected]> Signed-off-by: noeyy-mino <[email protected]> Signed-off-by: joe-nv <[email protected]> Signed-off-by: yingguo-trt <[email protected]> Signed-off-by: Shengliang Xu <[email protected]> Signed-off-by: Chenjie Luo <[email protected]> Signed-off-by: anmaurya001 <[email protected]> Signed-off-by: Connor Baker <[email protected]> Signed-off-by: wiederse <[email protected]> Signed-off-by: Vu Dinh <[email protected]> Signed-off-by: Pratik Gandhi <[email protected]> Signed-off-by: Michael Rusu <[email protected]> Signed-off-by: Michael-Rusu <[email protected]> Signed-off-by: namgyu-youn <[email protected]> Signed-off-by: Sylvester Kaczmarek <[email protected]> Signed-off-by: Javier de Jesus <[email protected]> Signed-off-by: javierdejesusda <[email protected]> Signed-off-by: Zhiyu Cheng <[email protected]> Signed-off-by: Juhi Mittal <[email protected]> Signed-off-by: Dmitry Rantovov <[email protected]> Signed-off-by: h-guo18 <[email protected]> Co-authored-by: Chad Voegele <[email protected]> Co-authored-by: LinCanNerd <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: Keval Morabia <[email protected]> Co-authored-by: Wei-Ming Chen <[email protected]> Co-authored-by: noeyy-mino <[email protected]> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: kaix-nv <[email protected]> Co-authored-by: Zhehao Hu <[email protected]> Co-authored-by: joe <[email protected]> Co-authored-by: yingguo-trt <[email protected]> Co-authored-by: Shengliang Xu <[email protected]> Co-authored-by: Chenjie Luo <[email protected]> Co-authored-by: anmaurya001 <[email protected]> Co-authored-by: Connor Baker <[email protected]> Co-authored-by: Jiao Mingyang <[email protected]> Co-authored-by: Vu Dinh <[email protected]> Co-authored-by: Pratik Gandhi <[email protected]> Co-authored-by: Michael R <[email protected]> Co-authored-by: Michael-Rusu <[email protected]> Co-authored-by: namgyu-youn <[email protected]> Co-authored-by: Sylvester Kaczmarek <[email protected]> Co-authored-by: Javier De Jesus <[email protected]> Co-authored-by: Zhiyu <[email protected]> Co-authored-by: Juhi Mittal <[email protected]> Co-authored-by: Dmitry Rantovov <[email protected]> Co-authored-by: h-guo18 <[email protected]>
What does this PR do?
Type of change: Bug fix
Fix layerwise MoE export copying already-quantized fused expert tensors back from the source checkpoint as BF16 weights. Those copies incorrectly add the routed expert container to
exclude_modules, causing vLLM to select an unquantized MoE backend and fail loadingw2_input_scale.Snapshot complete source-key accounting at exporter binding, before per-layer packing removes the original fused parameters. Reuse the snapshot, including an empty result, for that source checkpoint. Only names are retained; genuinely unmodeled auxiliary weights still carry over. Whole-model export is unchanged.
Usage
No API changes. Re-export affected checkpoints from the original source using the existing layerwise recipe.
Testing
general/ptq/nvfp4_experts_only-kv_fp8_layerwise_export, compared with whole-model export, with and without an auxiliary source weight: passed. Packed expert weights/scales remain present, original fused BF16 weights are absent, and expert containers are not excluded. The auxiliary weight remains present and excluded.test_moe_export_matcheswith source provenance and the public export API. Both cases passed in a local one-layer CPU adaptation; both failed on the duplicate fused expert tensors when the snapshot lookup was reverted. The committed GPU test retains its original two-layer model and quantization configuration.git diff --check: passed.Before your PR is "Ready for review"
Contributor guidelines and security coding practices reviewed. Commit
b139a70ebis signed and signed off; its GPG signature was verified before publishing.CONTRIBUTING.md: N/A; neither.Additional Information
NVBug 6954041. Release backport: 0.48.0.
Summary by CodeRabbit