SAFMN icon indicating copy to clipboard operation
SAFMN copied to clipboard

训练时损失变为nan

Open jp0215 opened this issue 1 year ago • 2 comments

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

jp0215 avatar Oct 09 '23 13:10 jp0215

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

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

sunny2109 avatar Oct 09 '23 14:10 sunny2109

感谢回复!我再试一试

jp0215 avatar Oct 10 '23 00:10 jp0215