Skip to content

fix(dev): correct params->parameters typo in ChainedOptimizer.step() - #4357

Merged
ko3n1g merged 1 commit into
NVIDIA:devfrom
Phlip79:fix/decgrad-typo-dev
Apr 17, 2026
Merged

fix(dev): correct params->parameters typo in ChainedOptimizer.step()#4357
ko3n1g merged 1 commit into
NVIDIA:devfrom
Phlip79:fix/decgrad-typo-dev

Conversation

@Phlip79

@Phlip79 Phlip79 commented Apr 17, 2026

Copy link
Copy Markdown
Member

Summary

Port of #4277 to the dev branch.

Dev hits the same NameError that #4277 fixed on main:

File "megatron/core/optimizer/optimizer.py", line 1380, in step
    and getattr(params[0], "__fsdp_param__", False)
NameError: name 'params' is not defined

The surrounding clip_grad_by_total_norm_fp32 call already binds the local parameters, so this is a pure typo fix.

Changes

  • megatron/core/optimizer/optimizer.pyparams[0]parameters[0] in ChainedOptimizer.step() (the Megatron-FSDP + use_precision_aware_optimizer branch).
  • tests/unit_tests/distributed/megatron_fsdp/test_mcore_fully_sharded_data_parallel.py — add fp8="hybrid" to the optim_grads_params_fused_adam_e2e param block so the FSDP e2e test actually exercises the fixed code path.

The @pytest.mark.flaky_in_dev decorator is intentionally left in place on dev — whether the typo was the sole cause of flakiness is unclear, so the safeguard is preserved here even though #4277 removed it on main.

Test plan

  • CI green on dev
  • test_compatible_with_nd_parallel[optim_grads_params_fused_adam_e2e-*] no longer raises NameError

🤖 Generated with Claude Code

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>
@copy-pr-bot

copy-pr-bot Bot commented Apr 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Phlip79
Phlip79 marked this pull request as ready for review April 17, 2026 05:40
@Phlip79
Phlip79 requested review from a team as code owners April 17, 2026 05:40
@ko3n1g
ko3n1g merged commit c2c7f0f into NVIDIA:dev Apr 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants