fix(dev): correct params->parameters typo in ChainedOptimizer.step() - #4357
Merged
Conversation
Port of NVIDIA#4277 to dev. Fixes NameError raised when ChainedOptimizer.step() takes the Megatron-FSDP + precision-aware optimizer branch. Also adds the missing fp8="hybrid" mode to the optim_grads_params_fused_adam_e2e test parametrization so the FSDP e2e test exercises the fixed code path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
yaox12
approved these changes
Apr 17, 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
Port of #4277 to the
devbranch.Dev hits the same NameError that #4277 fixed on
main:The surrounding
clip_grad_by_total_norm_fp32call already binds the localparameters, so this is a pure typo fix.Changes
megatron/core/optimizer/optimizer.py—params[0]→parameters[0]inChainedOptimizer.step()(the Megatron-FSDP +use_precision_aware_optimizerbranch).tests/unit_tests/distributed/megatron_fsdp/test_mcore_fully_sharded_data_parallel.py— addfp8="hybrid"to theoptim_grads_params_fused_adam_e2eparam block so the FSDP e2e test actually exercises the fixed code path.The
@pytest.mark.flaky_in_devdecorator is intentionally left in place ondev— whether the typo was the sole cause of flakiness is unclear, so the safeguard is preserved here even though #4277 removed it onmain.Test plan
devtest_compatible_with_nd_parallel[optim_grads_params_fused_adam_e2e-*]no longer raisesNameError🤖 Generated with Claude Code