Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
9e026a93
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9e026a93
编写于
6月 07, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove chief
上级
7fbddaa6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
3 addition
and
8 deletion
+3
-8
python/paddle/fluid/io.py
python/paddle/fluid/io.py
+2
-4
python/paddle/fluid/trainer.py
python/paddle/fluid/trainer.py
+1
-4
未找到文件。
python/paddle/fluid/io.py
浏览文件 @
9e026a93
...
...
@@ -466,7 +466,6 @@ CHECKPOINT_SEPARATOR = "_"
def
save_checkpoint
(
executor
,
checkpoint_dir
,
trainer_id
,
is_chief
=
False
,
trainer_args
=
None
,
main_program
=
None
,
max_num_checkpoints
=
3
):
...
...
@@ -478,8 +477,7 @@ def save_checkpoint(executor,
:param executor executor for save the value
:param checkpoint_dir the checkpoint directory
:param trainer_id currect trainer id
:param is_chief if the trainer id equals 0, the is_chief will be true
:param trainer_id currect trainer id, if id is equal to 0, the trainer is chief
:param main_program will save all variables in program
:param max_num_checkpoints will keep numbers of checkpoint serials not bigger than max_num_checkpoints
"""
...
...
@@ -497,7 +495,7 @@ def save_checkpoint(executor,
save_trainer_args
(
cur_dir
,
trainer_id
,
trainer_args
)
if
is_chief
:
if
trainer_id
==
0
:
save_persist_vars_without_grad
(
executor
,
cur_dir
,
main_program
)
_scroll_delete
(
checkpoint_dir
,
max_num_checkpoints
)
...
...
python/paddle/fluid/trainer.py
浏览文件 @
9e026a93
...
...
@@ -136,7 +136,6 @@ class Trainer(object):
# config for checkpoint
# only chief worker will save variables
self
.
trainer_id
=
0
self
.
chief
=
True
self
.
checkpoint_cfg
=
checkpoint_config
if
self
.
checkpoint_cfg
:
assert
isinstance
(
self
.
checkpoint_cfg
,
CheckpointConfig
)
...
...
@@ -201,7 +200,6 @@ class Trainer(object):
self
.
nccl_id_var
=
None
else
:
self
.
trainer_id
=
int
(
os
.
getenv
(
"PADDLE_TRAINER_ID"
))
self
.
chief
=
self
.
trainer_id
==
0
port
=
os
.
getenv
(
"PADDLE_PSERVER_PORT"
)
worker_ips
=
os
.
getenv
(
"PADDLE_TRAINER_IPS"
)
worker_endpoints
=
[]
...
...
@@ -250,7 +248,7 @@ class Trainer(object):
# the unique trainer id, starting from 0, needed by trainer
# only
self
.
trainer_id
=
int
(
os
.
getenv
(
"PADDLE_TRAINER_ID"
,
"0"
))
self
.
chief
=
self
.
trainer_id
==
0
# the role, should be either PSERVER or TRAINER
training_role
=
os
.
getenv
(
"PADDLE_TRAINING_ROLE"
)
with
self
.
_prog_and_scope_guard
():
...
...
@@ -456,7 +454,6 @@ class Trainer(object):
executor
=
exe
,
checkpoint_dir
=
self
.
checkpoint_cfg
.
checkpoint_dir
,
trainer_id
=
self
.
trainer_id
,
is_chief
=
self
.
chief
,
trainer_args
=
self
.
_get_checkpoint_save_args
(
epoch_id
,
step_id
),
main_program
=
self
.
train_program
,
max_num_checkpoints
=
self
.
checkpoint_cfg
.
max_num_checkpoints
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录