T2T-ViT icon indicating copy to clipboard operation
T2T-ViT copied to clipboard

[maybe a bug] loss nan

Open xmy0916 opened this issue 4 years ago • 4 comments

https://github.com/yitu-opensource/T2T-ViT/blob/main/models/token_performer.py#L18 My code has turned on fp16, so the 1e-8 on this line to prevent division by 0 is not enough for my code... the loss of the network calculation appears nan due to this code : https://github.com/yitu-opensource/T2T-ViT/blob/main/models/token_performer.py#L50

xmy0916 avatar Jan 17 '22 13:01 xmy0916

Yes, you may be right, we can try to change 1e-8 to a large one, did you try it?

yuanli2333 avatar Jan 17 '22 14:01 yuanli2333

@yuanli2333 I have tested 1e-4 but also can't fix the problem.

xmy0916 avatar Jan 18 '22 03:01 xmy0916

@xmy0916 In my implementation, 1e-6 can fix this problem, with bs=2048 and lr=1e-3.

jiawangbai avatar Jan 19 '22 08:01 jiawangbai

Thanks!

xmy0916 avatar Jan 19 '22 10:01 xmy0916