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

a warning #21

Open
zhenhao-huang opened this issue Jul 20, 2021 · 2 comments
Open

a warning #21

zhenhao-huang opened this issue Jul 20, 2021 · 2 comments

Comments

@zhenhao-huang
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)

Is it ok?

@294coder
Copy link

pytorch warning, which means you should put "optimizer.step()" ahead of "lr_scheduler.step()" in your training phase.

@zhenhao-huang
Copy link
Author

In the main.py script, I put scheduler.step() after the train_loader loop, and the warning disappeared.

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

No branches or pull requests

2 participants