Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
486e1e33
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
694
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
486e1e33
编写于
5月 29, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fix and optimize
上级
ad9dfeb0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
8 deletion
+10
-8
python/paddle/fluid/trainer.py
python/paddle/fluid/trainer.py
+10
-8
未找到文件。
python/paddle/fluid/trainer.py
浏览文件 @
486e1e33
...
@@ -79,8 +79,9 @@ class CheckpointConfig(object):
...
@@ -79,8 +79,9 @@ class CheckpointConfig(object):
else
:
else
:
self
.
step_interval
=
step_interval
self
.
step_interval
=
step_interval
self
.
epoch_id
=
0
self
.
_epoch_id
=
0
self
.
step_id
=
0
self
.
_step_id
=
0
self
.
_load_serial
=
None
def
check_and_get_place
(
place
):
def
check_and_get_place
(
place
):
...
@@ -174,17 +175,17 @@ class Trainer(object):
...
@@ -174,17 +175,17 @@ class Trainer(object):
exe
=
executor
.
Executor
(
place
)
exe
=
executor
.
Executor
(
place
)
exe
.
run
(
self
.
startup_program
)
exe
.
run
(
self
.
startup_program
)
if
self
.
load_checkpoint
_serial
:
if
self
.
checkpoint
.
_load
_serial
:
exe
=
executor
.
Executor
(
place
)
exe
=
executor
.
Executor
(
place
)
io
.
load_checkpoint
(
exe
,
self
.
checkpoint
.
checkpoint_dir
,
io
.
load_checkpoint
(
exe
,
self
.
checkpoint
.
checkpoint_dir
,
self
.
load_checkpoint
_serial
,
self
.
checkpoint
.
_load
_serial
,
self
.
startup_program
)
self
.
startup_program
)
epoch_id
,
step_id
=
io
.
load_trainer_args
(
epoch_id
,
step_id
=
io
.
load_trainer_args
(
self
.
checkpoint
.
checkpoint_dir
,
self
.
load_checkpoint_serial
,
self
.
checkpoint
.
checkpoint_dir
,
self
.
load_checkpoint_serial
,
self
.
trainer_id
,
[
"epoch_id"
,
"step_id"
])
self
.
trainer_id
,
[
"epoch_id"
,
"step_id"
])
self
.
checkpoint
.
epoch_id
=
int
(
epoch_id
)
self
.
checkpoint
.
_
epoch_id
=
int
(
epoch_id
)
self
.
checkpoint
.
step_id
=
int
(
step_id
)
self
.
checkpoint
.
_
step_id
=
int
(
step_id
)
if
param_path
and
os
.
path
.
isdir
(
param_path
):
if
param_path
and
os
.
path
.
isdir
(
param_path
):
# load params from param_path into scope
# load params from param_path into scope
...
@@ -351,7 +352,7 @@ class Trainer(object):
...
@@ -351,7 +352,7 @@ class Trainer(object):
def
_train_by_any_executor
(
self
,
event_handler
,
exe
,
num_epochs
,
reader
):
def
_train_by_any_executor
(
self
,
event_handler
,
exe
,
num_epochs
,
reader
):
epochs
=
[
epochs
=
[
epoch_id
for
epoch_id
in
range
(
num_epochs
)
epoch_id
for
epoch_id
in
range
(
num_epochs
)
if
epoch_id
>=
self
.
checkpoint
.
epoch_id
if
epoch_id
>=
self
.
checkpoint
.
_
epoch_id
]
]
for
epoch_id
in
epochs
:
for
epoch_id
in
epochs
:
event_handler
(
BeginEpochEvent
(
epoch_id
))
event_handler
(
BeginEpochEvent
(
epoch_id
))
...
@@ -360,7 +361,8 @@ class Trainer(object):
...
@@ -360,7 +361,8 @@ class Trainer(object):
self
.
_clean_checkpoint
()
self
.
_clean_checkpoint
()
return
return
if
self
.
checkpoint
and
self
.
checkpoint
.
step_id
>=
step_id
and
self
.
checkpoint
.
epoch_id
==
epoch_id
:
if
self
.
checkpoint
and
self
.
checkpoint
.
_load_serial
\
and
self
.
checkpoint
.
_step_id
>=
step_id
and
self
.
checkpoint
.
_epoch_id
==
epoch_id
:
continue
continue
begin_event
=
BeginStepEvent
(
epoch_id
,
step_id
)
begin_event
=
BeginStepEvent
(
epoch_id
,
step_id
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录