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

Loss value appears NAN #33

Open
qiqiing opened this issue May 16, 2021 · 1 comment
Open

Loss value appears NAN #33

qiqiing opened this issue May 16, 2021 · 1 comment

Comments

@qiqiing
Copy link

qiqiing commented May 16, 2021

Hello, when I use the cross-scale attention module in your code and my own data for training, the Loss value becomes NAN as the number of training iterations increases. I can make sure that there is no NAN data in my data. When I reduce the size of the training image or set the batchsize to 1, the training loss becomes normal. Is it because the cross-scale attention module may cause gradient explosion? How can I improve it?

@HarukiYqM
Copy link
Collaborator

Hi, I am not quite sure why this happen but I do not observe such effects when training on DIV2K. It okay to reduce the input size, e.g., from 48 to 32 while keep the model working well. But one simple strategy is to resume from the checkpoint before it becomes NaN, or reduce the learning rate, for example, starting from 5e-5.
Hope this can solve your problem.

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