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

float point exception #563

Closed
333caowei opened this issue Nov 22, 2016 · 9 comments
Closed

float point exception #563

333caowei opened this issue Nov 22, 2016 · 9 comments
Assignees
Labels

Comments

@333caowei
Copy link

333caowei commented Nov 22, 2016

训练过程中经过多个pass之后会出现float point exception错误。

#46 #53 有提到可以通过更换模型,降低batcisize、降低学习速率或者优化算法可以解决这个问题。

经过实验发现降低batcisize(128变为50)、降低学习速率(adam由1e-3变为1e-4)并没有解决这个问题。
更换优化算法(由adam变为MomentumOptimizer(0.9))也还是会出现同样问题。

不知有没有什么别的办法可以解决这个float point exception问题

(注:训练样本大约50w条数据做序列分类,label大约8w个,90%数据序列长度小于10,集群版本paddle,训练了大约80个pass)

@liuyuuan
Copy link
Contributor

已经训练了80个pass,是否前80个pass中已经出现了较好的结果?建议观察一下训练集和测试集的cost和其他指标变化,判断一下是否在出现这个错误之前就已经过拟合可以停止训练了。如果确认还需要继续优化,可以尝试逐渐加大数据量或者逐渐减小网络规模。

@333caowei
Copy link
Author

333caowei commented Nov 23, 2016

@comeonfox 请问paddle如何进行early stop停止训练呢,搜了一下文档没发现,目前只能在在启动paddle时候配置num pass

@liuyuuan
Copy link
Contributor

主要通过 $num_passes 控制,在到达 $num_passes 之前,如果需要停止训练,可以直接kill掉任务,不会影响模型产出。被kill 之前的模型都保存在$save_dir 下, 每$saving_period个pass保存一次。

@333caowei
Copy link
Author

@comeonfox 也就是说early stop没办法动过代码逻辑中检测valid data的loss变化来停掉任务(类似于for循环break的逻辑),需要人工去kill任务吗

@backyes
Copy link
Contributor

backyes commented Nov 25, 2016

@pengli09 @lcy-seso
两位看看能不给出一些意见。

@pengli09
Copy link
Contributor

"label大约8w个",直觉label应该会非常脏(各种标注不一致等等),算出来的梯度应该也会有非常大的噪声,训练过程肯定会不稳定。所以建议是不是再重新审视一个问题建模本身,如:

  • 真的需要8w个类吗?
  • 确实需要8w个类的话,数据标注质量够吗?数据质量不够,模型不可能训好的

@luotao1 luotao1 closed this as completed Mar 15, 2017
@zhuantouer
Copy link

hi, 请问“float point exception”问题出现的原因找到了么,解决了么?

@lcy-seso
Copy link
Contributor

@zishuaiz 请问具体是哪个任务呢? FPE 的原因可能是多种的,(1)训练数据处理不当,或是异常数据;(2)梯度计算溢出等等,通常都是针对具体的训练任务分析。

如果您遇到什么问题,可以在新的issue中具体描述一下任务以及配置参数。

@zhuantouer
Copy link

@lcy-seso 任务在训练第9个pass时报错,应该不是数据处理不当或数据异常原因;
模型是双向lstm+crf作ner,lr=1e-3,batch_size=150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants