当前位置:网站首页>[深度学习][pytorch][原创]crnn在高版本pytorch上训练loss为nan解决办法
[深度学习][pytorch][原创]crnn在高版本pytorch上训练loss为nan解决办法
2022-06-24 09:52:00 【FL1623863129】
最近研究了下CRNN各种pytorch版本,发现里面一大半都是训练有问题,典型问题就是Loss训练几个epoch就变成nan,这样项目在github上有很多,我使用的是pytorch==1.7.0版本,之后发现一个很好解决方法。像网上说什么改学习率,梯度裁剪等等一堆都试了全部没用,偶然成功了一个项目发现为啥他就是对的,原来是CTCLoss设置问题,在高版本pytorch里面,需要在初始CTCLoss时候加个参数即可。
from torch.nn import CTCLoss
ctc_loss=CTCLoss(zero_infinity=True)
这样就是不会出现loss为nan问题,而且测试发现模型预测也正常,看起来这种方法是可行的。如果您遇到这种问题可以试试,如果觉得有用可以在下方留言。
边栏推荐
- Dedecms template file explanation and homepage label replacement
- Window function row in SQL Server_ number()rank()dense_ rank()
- 把騰訊搬到雲上,治愈了他們的技術焦慮
- Maui's way of learning -- Opening
- 88. merge ordered arrays
- System design: load balancing
- Network monitoring: active troubleshooting becomes simple
- Shape change loader loads jsjs special effect code
- Virtual CD-ROM function how to use and install virtual CD-ROM
- Maui的学习之路 -- 开篇
猜你喜欢

齐次坐标的理解

Group counting_ Structure and workflow of CPU

Canvas pipe animation JS special effect

Fashionable pop-up mode login registration window

腾讯开源项目「应龙」成Apache顶级项目:前身长期服务微信支付,能hold住百万亿级数据流处理...

88. merge ordered arrays

【本周六活动】.NET Day in China

Svg+js drag slider round progress bar
![[graduation season · attacking technology Er] three turns around the tree, what branch can we rely on?](/img/0a/0ebfa1e5c1bea6033b538528242252.png)
[graduation season · attacking technology Er] three turns around the tree, what branch can we rely on?
![[activities this Saturday] NET Day in China](/img/33/c0e8eeb8f673232a7c27bbaf5e713f.jpg)
[activities this Saturday] NET Day in China
随机推荐
What is the knowledge map? What does it do
"Write once, run at all ends", Qualcomm released AI software stack!
Fais ce que tu veux.
Thread operation principle
Attribute observer didset and willset in swift of swiftui swift internal skill
Maui's way of learning -- Opening
System design: key features of distributed systems
js中对象合并的4种方式,对象合并的4种方法
【本周六活动】.NET Day in China
09. Tencent cloud IOT device side learning -- RRPC and behavior
SQL Server about like operator (including the problem of field data automatically filling in spaces)
Many of my friends asked me what books and online classes I recommended. This time, I contributed all the materials that I had been hiding for a long time (Part 1)
[data analysis data source] coordinates of provinces, cities and administrative regions across the country (including boundary coordinate points and central coordinate points)
喜歡就去行動
齐次坐标的理解
"One good programmer is worth five ordinary programmers!"
Plant growth H5 animation JS special effect
A group of skeletons flying canvas animation JS special effect
Tencent wetest platform will bring new benefits in 2021 with 618 special offers!
Self service troubleshooting guide for redis connection login problems