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

About loss being NaN, lr_scheduler.step(), optimizer.step() #116

Open
FlyDre opened this issue Mar 23, 2022 · 2 comments
Open

About loss being NaN, lr_scheduler.step(), optimizer.step() #116

FlyDre opened this issue Mar 23, 2022 · 2 comments

Comments

@FlyDre
Copy link

FlyDre commented Mar 23, 2022

I've read issue #44. Like that case, I change the ResNet50 to another backbone.
So I check the link you mentioned:
https://discuss.pytorch.org/t/optimizer-step-before-lr-scheduler-step-error-using-gradscaler/92930/7

And therefore i change codes as below:
change

But seems losses( all 3 losses) still being NaN and the warning of "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" still exsists.

problem

Is this normal or do I need to modify losses.py?

Thank you.

@hkchengrex
Copy link
Owner

The warning can be ignored. It doesn't matter.
I think the problem is in the backbone (I see that you are using ConvNext). I've also tried ConvNext, but

  1. It gives NaN unless I turn off amp (--no_amp)
  2. Even when it is working it is converging much slower than ResNet50
    I would love to learn why/if you have a solution.

@FlyDre
Copy link
Author

FlyDre commented Mar 24, 2022

Thanks for replying. I'd update this issue if I figure it out.

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