fix(moe): preserve MLP dispatch through checkpoint wrappers#2955
Merged
Conversation
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Contributor
Author
|
/ok to test dabb4e1 |
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Contributor
Author
|
/ok to test 26c8ed5 |
Contributor
Author
|
/ok to test 439295d |
HuiyingLi
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Fix GPT-OSS and Qwen3-MoE MLP dispatch after activation checkpointing wraps the decoder block's
mlpmodule.Root cause
The decoder blocks selected the dense or MoE call signature with a forward-time
isinstance(self.mlp, ...)check. Activation checkpointing replacesself.mlpwith aCheckpointWrapperbefore FSDP2 sharding, so the wrapped module is no longer recognized asMLPorMoEand the MoE assertion fails on the first forward pass.The block already knows whether it is dense or MoE during construction. This change records that role and uses it for dispatch, independent of later wrappers.
Changelog
Validation
uv run --group test pytest -q tests/unit_tests/models/gpt_oss/test_gptoss_model.py tests/unit_tests/models/qwen3_moe/test_qwen3_moe_model.py tests/unit_tests/models/test_moe_checkpoint_wrapper_dispatch.py0.332 > 0.01). This change adds no parameters or state-dict keys.nemo-ci pipeline references
Before your PR is "Ready for review"
Pre checks:
Additional Information