Skip to content

[MFSDP] Preserve native v2 DTensor checkpoint projections - #9374

Open
WEIXILIN0307 wants to merge 2 commits into
NVIDIA:mainfrom
WEIXILIN0307:fix/mfsdp-v2-native-checkpoint
Open

WEIXILIN0307 wants to merge 2 commits into
NVIDIA:mainfrom
WEIXILIN0307:fix/mfsdp-v2-native-checkpoint

Conversation

@WEIXILIN0307

@WEIXILIN0307 WEIXILIN0307 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do?

Saving a native FSDP v2 SwiGLU checkpoint raises AttributeError when the shared preprocessor sends its DTensors to the v1 projection converter. The converter expects megatron_fsdp_slice, which native v2 DTensors lack.

Skip that conversion for v2 in the shared save/load path. Native v2 saves and restores packed projection keys, and v1 keeps its split _w and _v keys. This fixes native v2 resume within its own layout. A future format change needs a separate restore test for existing packed checkpoints. Related format work

Review guide

Start with the SwiGLU version guard. Check that the guard applies to both save and load. Expert naming, uneven-DTensor handling and fused MLA keep their existing paths. Then check the production save/load regression.

Validation

On 4a968a8, EP1 and EP2 BF16 MoE cases pass per rank on two RTX A6000s. Both check the packed expert keys on disk and restore into a separately initialized model. Parameters, Adam state, step counters and the next loss match the uninterrupted run. EP4 was skipped on two GPUs. Cross-format restore and upstream GPU CI remain pending.

python -m torch.distributed.run --standalone --nproc-per-node=2 -m pytest -q --experimental \
  tests/unit_tests/distributed/mfsdp_v2/test_checkpoint.py -k ep_fsdp_checkpoint_roundtrip

Issue tracking

Independent checkpoint fix used by the save/restore validation in #9112 and discussed in #9113.

Code provenance

No external code copied or adapted.

Contribution process

  • Relevant unit tests accompany the fix.
  • Registered functional-test coverage.
  • Focused format and lint checks.

Apply v1 projection conversion only to v1 checkpoints. Exercise native v2 SwiGLU MoE save/load and continued training with exact parameter, Adam and step comparisons.

Signed-off-by: Pinoeer-kingxi <13022943007@163.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Keep the existing fused MLA conversion. Check the packed expert keys on disk and compare model and Adam state across save/load and one resumed step.

Signed-off-by: Pinoeer-kingxi <weixilin307@gmail.com>
@WEIXILIN0307
WEIXILIN0307 marked this pull request as ready for review November 25, 2026 01:50
@WEIXILIN0307
WEIXILIN0307 requested a review from a team as a code owner November 25, 2026 01:50
@svcnvidia-nemo-ci
svcnvidia-nemo-ci requested a review from a team November 25, 2026 01:50
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants