Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_38905368
tensorflow
提交
1ceb0103
T
tensorflow
项目概览
qq_38905368
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1ceb0103
编写于
6月 23, 2016
作者:
W
Wei Ho
提交者:
TensorFlower Gardener
6月 23, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start respecting keep_checkpoint_max
Change: 125712724
上级
2353838f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
11 addition
and
3 deletion
+11
-3
tensorflow/contrib/learn/python/learn/estimators/estimator.py
...orflow/contrib/learn/python/learn/estimators/estimator.py
+1
-0
tensorflow/contrib/learn/python/learn/graph_actions.py
tensorflow/contrib/learn/python/learn/graph_actions.py
+10
-3
未找到文件。
tensorflow/contrib/learn/python/learn/estimators/estimator.py
浏览文件 @
1ceb0103
...
...
@@ -496,6 +496,7 @@ class BaseEstimator(sklearn.BaseEstimator):
supervisor_is_chief
=
is_chief
,
supervisor_master
=
self
.
_config
.
master
,
supervisor_save_model_secs
=
self
.
_config
.
save_checkpoints_secs
,
keep_checkpoint_max
=
self
.
_config
.
keep_checkpoint_max
,
feed_fn
=
feed_fn
,
steps
=
steps
,
fail_on_nan_loss
=
fail_on_nan_loss
,
...
...
tensorflow/contrib/learn/python/learn/graph_actions.py
浏览文件 @
1ceb0103
...
...
@@ -87,10 +87,12 @@ class NanLossDuringTrainingError(RuntimeError):
return
'NaN loss during training.'
def
_make_saver
(
graph
):
def
_make_saver
(
graph
,
keep_checkpoint_max
=
5
):
vars_to_save
=
graph
.
get_collection
(
ops
.
GraphKeys
.
VARIABLES
)
if
vars_to_save
:
return
tf_saver
.
Saver
(
vars_to_save
,
sharded
=
True
)
return
tf_saver
.
Saver
(
vars_to_save
,
sharded
=
True
,
max_to_keep
=
keep_checkpoint_max
)
else
:
return
None
...
...
@@ -136,6 +138,7 @@ def train(graph,
supervisor_is_chief
=
True
,
supervisor_master
=
''
,
supervisor_save_model_secs
=
600
,
keep_checkpoint_max
=
5
,
supervisor_save_summaries_steps
=
100
,
feed_fn
=
None
,
steps
=
None
,
...
...
@@ -176,6 +179,10 @@ def train(graph,
supervisor_master: The master string to use when preparing the session.
supervisor_save_model_secs: Save a checkpoint every
`supervisor_save_model_secs` seconds when training.
keep_checkpoint_max: The maximum number of recent checkpoint files to
keep. As new files are created, older files are deleted. If None or 0,
all checkpoint files are kept. This is simply passed as the max_to_keep
arg to tf.Saver constructor.
supervisor_save_summaries_steps: Save summaries every
`supervisor_save_summaries_steps` seconds when training.
feed_fn: A function that is called every iteration to produce a `feed_dict`
...
...
@@ -241,7 +248,7 @@ def train(graph,
init_feed_dict
=
init_feed_dict
,
is_chief
=
supervisor_is_chief
,
logdir
=
output_dir
,
saver
=
_make_saver
(
graph
),
saver
=
_make_saver
(
graph
,
keep_checkpoint_max
),
global_step
=
global_step_tensor
,
summary_op
=
None
,
summary_writer
=
summary_writer
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录