Repository navigation
Fix Muon retaining unused CPU weight initializers - #7527
Merged
yashaswikarnati merged 2 commits intoSep 23, 2026
Merged
yashaswikarnati merged 2 commits into
yashaswikarnati merged 2 commits into
Conversation
Signed-off-by: ykarnati <ykarnati@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. |
Signed-off-by: ykarnati <ykarnati@nvidia.com>
yashaswikarnati
marked this pull request as ready for review
September 20, 2026 05:54
Contributor
Author
|
/ok to test 5e3a140 |
Phlip79
approved these changes
Sep 21, 2026
jaredcasper
approved these changes
Sep 23, 2026
kunlunl
approved these changes
Sep 23, 2026
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/35820216918 |
shjwudp
added a commit
to shjwudp/Megatron-LM
that referenced
this pull request
Sep 23, 2026
…onfig fields Port dev's optimizer wiring hunks (dev:optimizer/__init__.py:767-822, 838-843, 968-993, 1013-1022) onto main: - replace main's blanket MFSDPv2+emerging-optimizers rejection with the prototype's covered-only gate: --optimizer muon + muon_scalar_optimizer='adam' + use_distributed_optimizer=False + sharded expert main weights; every other combination keeps a hard rejection. - single mixed dense/expert Muon bucket (dev keeps per-parameter expert metadata and MFSDP communication group), FsdpMuon wrap over the emerging-optimizers inner optimizer + FullyShardedOptimizer and grad_stats/tp_group attrs, and the Adam fallback's empty-shard filtering for MFSDP v2. - OptimizerConfig.muon_dp_subgroup_size / muon_max_params_per_owner_chunk (dev :optimizer_config.py:282-288); CLI flows from LANES-PLUMB's arguments.py by name. - expert_main_weight_is_sharded imported defensively from mcore_fsdp_adapter (LANES-PLUMB provides it; pointed error on the Muon+EP path if absent). Keeps main's newer fixes untouched: _clear_high_precision_initializers (NVIDIA#7527), hybrid-FSDP grad-stats group, 2-tuple bucket keys. No inter_dist_opt/inter_expt_dp references in the ported hunks (audited per LANES-PLUMB contract addendum). Signed-off-by: Jack Chang <jianbinc@nvidia.com>
xuwchen
pushed a commit
to xuwchen/Megatron-LM
that referenced
this pull request
Oct 14, 2026
Signed-off-by: ykarnati <ykarnati@nvidia.com> (cherry picked from commit 8d1ea07) Signed-off-by: xuwenc <xuwenc@nvidia.com>
xuwchen
pushed a commit
to xuwchen/Megatron-LM
that referenced
this pull request
Oct 14, 2026
Signed-off-by: ykarnati <ykarnati@nvidia.com> (cherry picked from commit 8d1ea07) Signed-off-by: xuwenc <xuwenc@nvidia.com>
This branch was previously deployed
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?
Layer-wise Muon only consumes saved high-precision initialization tensors for parameters owned by the local optimizer rank. Its early return from
get_megatron_optimizerbypasses the existing model-wide cleanup, leaving CPU initialization copies for non-owned parameters referenced after optimizer construction.Extract the existing cleanup into a shared helper and call it after construction on the emerging-optimizer and FSDP return paths, as well as the standard Adam/SGD path. The sweep runs after local master weights have been initialized and visits non-owned and frozen parameters too.
The change contains only the optimizer factory fix and focused regression tests.
CI uses the documented
determinism-exemptlabel because this change releases saved initializer references after master-weight construction; optimizer arithmetic and kernel dispatch are unchanged.Pre-checks