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显示持续显示为inf #69

Open
RobertXiaobinW opened this issue May 30, 2021 · 1 comment
Open

梯度爆炸,loss显示持续显示为inf #69

RobertXiaobinW opened this issue May 30, 2021 · 1 comment

Comments

@RobertXiaobinW
Copy link

博主,我试了把学习率调小和batch_size调小,但还是无法解决这个问题,是ctc_loss本身出现了什么问题吗?
这个是loss:tensor(inf, device='cuda:0', grad_fn = '<' MeanBackward0 '>' )
这个是input_length: tensor([1, 1, 1, 1, 1, 1, 1, 1])
这个是target_length: tensor([18, 9, 17, 6, 20, 11, 15, 13])
这个是target:
tensor([[ 788, 12398, 16864, 10277, 27893, 26725, 11970, 12494, 24441, 12486,
651, 25194, 21985, 10739, 28449, 18115, 24168, 24136, 0, 0,
0, 0, 0, 0, 0, 0],
[18490, 13217, 26361, 8336, 13865, 21787, 8350, 9127, 14206, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0],
[21562, 11474, 8698, 8510, 26653, 98, 9792, 26585, 18390, 9982,
12594, 27589, 15995, 1506, 25033, 29164, 27935, 0, 0, 0,
0, 0, 0, 0, 0, 0],
[22313, 20842, 22277, 28439, 26443, 9748, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0],
[30493, 20836, 25265, 23656, 24147, 15982, 27451, 28809, 28860, 11399,
16812, 8996, 17091, 27334, 10614, 16839, 28066, 15049, 21229, 21864,
0, 0, 0, 0, 0, 0],
[14392, 28384, 12272, 22050, 13004, 16370, 19666, 8364, 47, 18037,
15336, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0],
[25636, 16725, 755, 24788, 11787, 17582, 20783, 26430, 24712, 8278,
25356, 13494, 13120, 29164, 9054, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0],
[24467, 10223, 13797, 9870, 17309, 28066, 14946, 14523, 10659, 8469,
27858, 9383, 19832, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0]])

@henuliulei
Copy link

请问你解决了吗

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