Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Warning with PyTorch 1.4 #14

Closed
djstrong opened this issue Jan 22, 2020 · 4 comments
Closed

Warning with PyTorch 1.4 #14

djstrong opened this issue Jan 22, 2020 · 4 comments

Comments

@djstrong
Copy link

UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
"https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning)

@prajjwal1
Copy link

prajjwal1 commented Jan 23, 2020

You can send a PR for this, I guess

@djstrong
Copy link
Author

djstrong commented Jan 23, 2020

I changed it in

adaptive-span/trainer.py

Lines 65 to 67 in d882404

if scheduler is not None:
scheduler.step()
optimizer.step()
but scheduler.step is also called in _load_checkpoint.

@tesatory
Copy link
Contributor

Yes, I've seen this warning, but don't think it matters that much since our warming up takes thousands of steps and shift by one step should be negligible.

@djstrong
Copy link
Author

Great, thanks for explanation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants