fix(fsdp2): guard uninitialized accumulated grads - #2744
Merged
Conversation
akoumpa
force-pushed
the
akoumpa/fix/fsdp2-unsharded-param
branch
2 times, most recently
from
June 23, 2026 19:00
1fa2fa2 to
b5b5313
Compare
akoumpa
commented
Jun 23, 2026
| FSDPParam.to_accumulated_grad_if_needed = guarded | ||
|
|
||
|
|
||
| _patch_fsdp_accumulated_grad_guard() |
Contributor
Author
There was a problem hiding this comment.
this modifies global behavior that downstream libraries may assume, so I'm not 100% sure will move forward with it.
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
akoumpa
force-pushed
the
akoumpa/fix/fsdp2-unsharded-param
branch
from
June 23, 2026 19:07
b5b5313 to
ced1acc
Compare
Contributor
Author
|
/ok to test ced1acc |
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 ?
Adds a common FSDP2 guard so post-backward skips params whose lazy unsharded tensor was never created.
This fixes checkpoint robustness crashes for text-only Ministral3 runs that load through the VLM implementation and leave modality towers unused during backward.
Changelog
FSDPParam.to_accumulated_grad_if_needed()when_unsharded_paramis absent.Before your PR is "Ready for review"
Pre checks:
Additional Information
Short stack trace segment from the failing nemo-ci job:
Verification:
pytest -q tests/unit_tests/distributed/test_parallelizer.py::test_fsdp_accumulated_grad_guard_skips_uninitialized_params