Repository navigation
[PyTorch] Add FusedAdam.update_param - #3825
Merged
Merged
Conversation
timmoon10
reviewed
Nov 7, 2026
timmoon10
left a comment
Member
There was a problem hiding this comment.
Overall this is a good idea. The optimizer state for master weights can get weird and esoteric (especially the BF16 remainders trick) and it's not reasonable for users to interact with it directly. With some minor tweaks, this API is very straightforward.
Contributor
[Medium impact] The change reaches callers that choose to use FusedAdam's new parameter-update method. Add the FP32 input check before merging so invalid reloads leave weights and optimizer state untouched. Findings
SummaryAdds
Reviews (4) · Last reviewed commit: "Debug doc generation" · Reviewed by Greptile |
cspades
approved these changes
Nov 17, 2026
Member
|
/te-ci L1 pytorch |
timmoon10
reviewed
Nov 30, 2026
Member
|
/te-ci pytorch L1 |
Add a method that replaces a parameter and its FP32 master weights without resetting Adam history, for use after loading model weights without optimizer state. It accepts full FP32 values when store_param_remainders is enabled, writing the BF16 high bits with the same rounding convention as AdamFunctorMasterParamRemainder, and supports quantized and DTensor parameters. The method rejects tensors the optimizer does not own (e.g. param.data), DTensor masters whose mesh, placements or shape differ from the parameter, non-FP32 values and mismatched local shapes, all before mutating any state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Carlos Gomes <cgomes@nvidia.com>
Signed-off-by: Carlos Gomes <cgomes@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
CarlosGomes98
force-pushed
the
fix/reload-master-params
branch
from
December 1, 2026 08:49
a509755 to
1963bc5
Compare
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.
Add a method that replaces a parameter and its FP32 master weights without resetting Adam history, for use after loading model weights without optimizer state. It accepts full FP32 values when store_param_remainders is enabled, writing the BF16 high bits with the same rounding convention as AdamFunctorMasterParamRemainder, and supports quantized and DTensor parameters.
The method rejects tensors the optimizer does not own (e.g. param.data), DTensor masters whose mesh, placements or shape differ from the parameter and mismatched local shapes, all before mutating any state.
Description
Please include a brief summary of the changes, relevant motivation and context.
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: