[ckpt] fix: honor disabled RNG saves - #5323
Merged
Merged
Conversation
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test 3c5b4bb |
Contributor
|
LGTM - clean, well-scoped change that avoids collecting RNG state (and the associated all_gather_object collective plus CUDA init) when save_rng=False. Verified:
Suggested test cases:
No perf tests impacted. |
yaoyu-33
approved these changes
Aug 14, 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.
Summary
What
CheckpointConfig.save_rngis enabledexisting
save_rng=FalseconfigurationRoot cause
save_megatron_model()explicitly constructs conversion checkpoint state withsave_rng=False, because a weight-conversion checkpoint does not need trainingRNG state. Both Bridge save paths ignored that contract:
save_checkpoint()calledget_rng_state()unconditionallyget_rng_state()beforegenerating its prebuilt state dictionary
On a genuine CPU-only node this attempted
torch.cuda.get_rng_state()after all20.9B GPT-OSS parameters had loaded. Exact-public DFW job
15100682failed atcheckpoint save with
RuntimeError: Found no NVIDIA driver on your system.No local patch was used in that run and no checkpoint output was produced.
Normal training behavior is unchanged: when
save_rng=True, RNG state is stillcollected and included as before.
Validation
save_rng=Truesave_rng=Falseuv run --no-sync pre-commit run --all-fileshead containing this fix
Full CPU conversion remains unverified until the original workload passes and
the produced checkpoint passes its later GPU/TE load gate.