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

训练时损失变为nan #17

Open
jp0215 opened this issue Oct 9, 2023 · 2 comments
Open

训练时损失变为nan #17

jp0215 opened this issue Oct 9, 2023 · 2 comments

Comments

@jp0215
Copy link

jp0215 commented Oct 9, 2023

请问作者在训练的时候有没有出现损失变为nan的情况呢?如果有的话是怎样解决的呢?

@sunny2109
Copy link
Owner

你好,你训练的时候是按照我给的setting吗?我之前的训练过程中没遇到过。

出现nan的时候,一般可以通过增加梯度裁剪(torch.nn.utils.clip_grad_norm_(self.net_g.parameters(), 0.01))或者调整学习率来避免。

@jp0215
Copy link
Author

jp0215 commented Oct 10, 2023

感谢回复!我再试一试

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