Repository navigation
Fix fused MLA and MTP checkpointing for Megatron-FSDP. - #6271
Conversation
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
/ok to test aa30d8f. |
| strict_fsdp_dtensor_model_load: Literal[ | ||
| "assume_ok_unexpected", | ||
| "log_unexpected", | ||
| "log_all", | ||
| "raise_unexpected", | ||
| "raise_all", | ||
| "return_unexpected", | ||
| "return_all", | ||
| "ignore_all", | ||
| ] = "raise_unexpected" | ||
| """Determine handling of model weights an FSDP DTensor partial load cannot supply. | ||
| Check StrictHandling docs for flags meaning. Only applies when strict_fsdp_dtensor_load is | ||
| False, where the underlying load would otherwise skip such weights silently and leave them | ||
| at their initialized values. Unlike strict_fsdp_dtensor_load this covers only the model | ||
| sections, so optimizer and RNG state that is intentionally absent does not trip it. Weights | ||
| the checkpoint holds but this rank does not need are always fine, as expected under | ||
| pipeline, tensor and expert parallelism. Ignored when finetune is set.""" | ||
|
|
||
| dist_ckpt_strictness: Literal[ |
There was a problem hiding this comment.
Can we just pipe the existing dist_ckpt_strictness argument to FSDP?
| def _intersect_slice(s1, s2): | ||
| """Intersection of two step-1 slices, or an empty slice when they do not overlap.""" | ||
| start = max(s1.start, s2.start) | ||
| stop = min(s1.stop, s2.stop) | ||
| return slice(0, 0) if start >= stop else slice(start, stop) |
There was a problem hiding this comment.
There's a similar function in the SwiGLU transforms, I think this can be used for that.
|
/ok to test 6fee9a5. |
|
@cspades Please see updated description of this PR - it includes the details from the save/load parity testing. Thanks. |
Signed-off-by: Ritesh Patel <ripatel@nvidia.com>
…e helpers. Signed-off-by: Ritesh Patel <ripatel@nvidia.com>
6fee9a5 to
1515dc7
Compare
|
/ok to test 1515dc7. |
…nit test. Signed-off-by: Ritesh Patel <ripatel@nvidia.com>
e61006c to
a4f7722
Compare
|
/ok to test 6069334 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/32320591753 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/32345646452 |
Signed-off-by: Ritesh Patel <ripatel@nvidia.com> Co-authored-by: gautham-kollu <gkollu@nvidia.com> Signed-off-by: Kezhi Kong <kezhik@kezhik-mlt.client.nvidia.com>
Signed-off-by: Ritesh Patel <ripatel@nvidia.com> Co-authored-by: gautham-kollu <gkollu@nvidia.com>
What does this PR do?
Fixes fused MLA and MTP checkpointing for Megatron-FSDP.
Aside from the newly added unit tests, this PR was also tested manually for save/load parity check for the fused MLA + MTP path:
The 3 main checks were:
Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.