Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
87867d4c
提交
87867d4c
authored
5月 25, 2015
作者:
hantek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust grammar and rewrite the last part
上级
8ff173ff
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
19 行删除
+20
-19
nanguardmode.txt
doc/library/compile/nanguardmode.txt
+1
-1
nan_tutorial.txt
doc/tutorial/nan_tutorial.txt
+19
-18
没有找到文件。
doc/library/compile/nanguardmode.txt
浏览文件 @
87867d4c
...
@@ -16,4 +16,4 @@ Guide
...
@@ -16,4 +16,4 @@ Guide
The NanGuardMode aims to prevent the model from outputing NaNs or Infs. It has
The NanGuardMode aims to prevent the model from outputing NaNs or Infs. It has
a number of self-checks, which can help to find out which apply node is
a number of self-checks, which can help to find out which apply node is
generating those incorrect output.
generating those incorrect output
s
.
doc/tutorial/nan_tutorial.txt
浏览文件 @
87867d4c
...
@@ -8,24 +8,24 @@ Dealing with NaNs
...
@@ -8,24 +8,24 @@ Dealing with NaNs
Having a model yielding NaNs or Infs is quite common if some of the tiny
Having a model yielding NaNs or Infs is quite common if some of the tiny
components in your model are not set properly. NaNs are hard to deal with
components in your model are not set properly. NaNs are hard to deal with
because sometimes it is caused by a bug or error in the code, sometimes it's
because sometimes it is caused by a bug or error in the code, sometimes it's
because of the numerical stability of your
actual computing systerm, and even,
because of the numerical stability of your
computational environment (library
sometimes it relates to your algorithm. Here we try to outline common, basic
versions, etc.), and even, sometimes it relates to your algorithm. Here we try
issues which cause the model to yield NaNs, as well as provide nails and
to outline common issues which cause the model to yield NaNs, as well as
hammers to diagnose it.
provide nails and
hammers to diagnose it.
Check Superparameters and Weight Initialization
Check Superparameters and Weight Initialization
-----------------------------------------------
-----------------------------------------------
Most frequently, the cause would be that some of the
su
perparameters, especially
Most frequently, the cause would be that some of the
hy
perparameters, especially
learning rates, are set incorrectly. A high learning rate can blow up your whole
learning rates, are set incorrectly. A high learning rate can blow up your whole
model into NaN outputs even within one epoch of training. So the first and
model into NaN outputs even within one epoch of training. So the first and
easiest
way is try to lower it. Keep halving your learning rate until you start
easiest
solution is try to lower it. Keep halving your learning rate until you
to get resonable output values.
start
to get resonable output values.
Other
su
perparameters may also play a role. For example, are your training
Other
hy
perparameters may also play a role. For example, are your training
algorithms involve regularization terms? If so, are their corresponding
algorithms involve regularization terms? If so, are their corresponding
penalties set re
sonably? Search a wider su
perparameter space with a few (one or
penalties set re
asonably? Search a wider hy
perparameter space with a few (one or
two) training eopchs each to see if the NaNs could disappear.
two) training eopchs each to see if the NaNs could disappear.
Some models can be very sensitive to the initialization of weight vectors. If
Some models can be very sensitive to the initialization of weight vectors. If
...
@@ -36,10 +36,11 @@ that the model ends up with yielding NaNs.
...
@@ -36,10 +36,11 @@ that the model ends up with yielding NaNs.
Run in DebugMode
Run in DebugMode
-----------------
-----------------
If adjusting
su
perparameters doesn't work for you, you can still get help from
If adjusting
hy
perparameters doesn't work for you, you can still get help from
Theano's DebugMode. Run your code in DebugMode with flag
Theano's DebugMode. Run your code in DebugMode with flag
mode=DebugMode,
DebugMode.check_py=False. This will give you clue about which op is causing this
DebugMode.check_py=False. This will give you clue about which op is causing this
problem, and then you can inspect into that op in more detail.
problem, and then you can inspect into that op in more detail. For a detailed
of using DebugMode, please refere to :ref:`debugmode`.
Theano's MonitorMode can also help. It can be used to step through the execution
Theano's MonitorMode can also help. It can be used to step through the execution
of a function. You can inspect the inputs and outputs of each node being
of a function. You can inspect the inputs and outputs of each node being
...
@@ -51,15 +52,15 @@ Numerical Stability
...
@@ -51,15 +52,15 @@ Numerical Stability
-------------------
-------------------
After you have located the op which causes the problem, it may turn out that the
After you have located the op which causes the problem, it may turn out that the
NaNs yielded by that op are related to numerical issues. For example,
NaNs yielded by that op are related to numerical issues. For example,
:math:
1 / log(p(x) + 1)
may result in NaNs for those nodes who have learned to yield
`1 / log(p(x) + 1)`
may result in NaNs for those nodes who have learned to yield
a low probability p(x) for some input x.
a low probability p(x) for some input x.
Algorithm Related
Algorithm Related
-----------------
-----------------
The hardest thing is that, after tracing back through all the former processes,
In the most difficult situations, you may go through the above steps and find
it turns out that nothing goes wrong. If unfortunately you reaches here, there
nothing wrong. If the above methods fail to uncover the cause, there is a good
is high chance that something is wrong in your algorithm. Go back to the
chance that something is wrong with your algorithm. Go back to the mathematics
mathematics
and find out if everything is derived correctly.
and find out if everything is derived correctly.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论