Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learning Rate Sudden Dropped to min_lr after Warm-up Steps #11149

Open
zixianwang2022 opened this issue Nov 4, 2024 · 1 comment
Open

Learning Rate Sudden Dropped to min_lr after Warm-up Steps #11149

zixianwang2022 opened this issue Nov 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@zixianwang2022
Copy link

Describe the bug

Hi, I am observing that the learning rate suddenly dropped to model.optim.sched.min_lr after model.optim.sched.warmup_steps. I am using CosineAnnealing, where I am expecting the learning rate will gradually drop to min_lr after warmup steps instead of suddenly dropping.
Image

Steps/Code to reproduce bug

  optim:
    name: distributed_fused_adam
    lr: 5e-6
    weight_decay: 0.01 
    betas: 
    - 0.9
    - 0.98
    sched:

      name: CosineAnnealing
      warmup_steps: 250
      constant_steps: 2500

      min_lr: 1e-7

Expected behavior

I am expecting the learning rate will gradually drop to min_lr after warmup steps instead of suddenly dropping. If I am doing it the wrong way, what should be the correct way of making this possible?

Environment overview (please complete the following information)

  • PyTorch version 2.3
  • Python version 3.10
@zixianwang2022 zixianwang2022 added the bug Something isn't working label Nov 4, 2024
@csn1011
Copy link

csn1011 commented Nov 9, 2024

Looking herehttps://github.com/NVIDIA/NeMo/blob/main/nemo/core/optim/lr_scheduler.py#L353 you may need to set decay_steps (If I'm looking in the correct place). It looks like during the warmup_steps the learning rate linearly ramps to max_lr, then decays to min_lr during decay_steps. Curious if that works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants