Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
d712af25
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d712af25
编写于
5月 30, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add distribute config
上级
0deb6f90
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
10 deletion
+15
-10
python/paddle/fluid/trainer.py
python/paddle/fluid/trainer.py
+15
-10
未找到文件。
python/paddle/fluid/trainer.py
浏览文件 @
d712af25
...
...
@@ -81,7 +81,8 @@ class CheckpointConfig(object):
self
.
epoch_id
=
0
self
.
step_id
=
0
self
.
_load_serial
=
None
self
.
load_serial
=
None
self
.
is_pserver
=
False
def
check_and_get_place
(
place
):
...
...
@@ -145,7 +146,7 @@ class Trainer(object):
"The checkpoint_config shoule be an instance of CheckpointConfig"
)
else
:
self
.
checkpoint
.
_
load_serial
=
io
.
need_load_checkpoint
(
self
.
checkpoint
.
load_serial
=
io
.
need_load_checkpoint
(
self
.
checkpoint
.
checkpoint_dir
)
self
.
scope
=
core
.
Scope
()
...
...
@@ -176,17 +177,18 @@ class Trainer(object):
exe
=
executor
.
Executor
(
place
)
exe
.
run
(
self
.
startup_program
)
if
self
.
checkpoint
and
self
.
checkpoint
.
_
load_serial
:
if
self
.
checkpoint
and
self
.
checkpoint
.
load_serial
:
exe
=
executor
.
Executor
(
place
)
io
.
load_checkpoint
(
exe
,
self
.
checkpoint
.
checkpoint_dir
,
self
.
checkpoint
.
_
load_serial
,
self
.
checkpoint
.
load_serial
,
self
.
startup_program
)
epoch_id
,
step_id
=
io
.
load_trainer_args
(
self
.
checkpoint
.
checkpoint_dir
,
self
.
checkpoint
.
_load_serial
,
self
.
trainer_id
,
[
"epoch_id"
,
"step_id"
])
self
.
checkpoint
.
epoch_id
=
int
(
epoch_id
)
self
.
checkpoint
.
step_id
=
int
(
step_id
)
if
not
self
.
checkpoint
.
is_pserver
:
epoch_id
,
step_id
=
io
.
load_trainer_args
(
self
.
checkpoint
.
checkpoint_dir
,
self
.
checkpoint
.
load_serial
,
self
.
trainer_id
,
[
"epoch_id"
,
"step_id"
])
self
.
checkpoint
.
epoch_id
=
int
(
epoch_id
)
self
.
checkpoint
.
step_id
=
int
(
step_id
)
if
param_path
and
os
.
path
.
isdir
(
param_path
):
# load params from param_path into scope
...
...
@@ -259,6 +261,9 @@ class Trainer(object):
t
.
transpile
(
trainer_id
,
pservers
=
pserver_endpoints
,
trainers
=
trainers
)
if
training_role
==
"PSERVER"
:
if
self
.
checkpoint
:
self
.
is_pserver
=
True
self
.
train_program
=
t
.
get_pserver_program
(
current_endpoint
)
self
.
startup_program
=
t
.
get_startup_program
(
current_endpoint
,
self
.
train_program
)
...
...
@@ -362,7 +367,7 @@ class Trainer(object):
self
.
_clean_checkpoint
()
return
if
self
.
checkpoint
and
self
.
checkpoint
.
_
load_serial
\
if
self
.
checkpoint
and
self
.
checkpoint
.
load_serial
\
and
self
.
checkpoint
.
step_id
>=
step_id
and
self
.
checkpoint
.
epoch_id
==
epoch_id
:
continue
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录