Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
hapi
提交
e677a23d
H
hapi
项目概览
PaddlePaddle
/
hapi
通知
11
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hapi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e677a23d
编写于
4月 30, 2020
作者:
L
LielinJiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code
上级
fd163f53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
15 deletion
+8
-15
hapi/callbacks.py
hapi/callbacks.py
+1
-1
hapi/model.py
hapi/model.py
+7
-14
未找到文件。
hapi/callbacks.py
浏览文件 @
e677a23d
...
@@ -296,7 +296,7 @@ class ProgBarLogger(Callback):
...
@@ -296,7 +296,7 @@ class ProgBarLogger(Callback):
self
.
tested_samples
=
0
self
.
tested_samples
=
0
self
.
test_progbar
=
ProgressBar
(
self
.
test_progbar
=
ProgressBar
(
num
=
self
.
test_steps
,
verbose
=
self
.
verbose
)
num
=
self
.
test_steps
,
verbose
=
self
.
verbose
)
if
ParallelEnv
().
local_rank
==
0
:
if
self
.
_is_print
()
:
print
(
'Predict begin...'
)
print
(
'Predict begin...'
)
def
on_test_batch_end
(
self
,
step
,
logs
=
None
):
def
on_test_batch_end
(
self
,
step
,
logs
=
None
):
...
...
hapi/model.py
浏览文件 @
e677a23d
...
@@ -1303,22 +1303,19 @@ class Model(fluid.dygraph.Layer):
...
@@ -1303,22 +1303,19 @@ class Model(fluid.dygraph.Layer):
cbks
.
on_begin
(
'train'
)
cbks
.
on_begin
(
'train'
)
for
epoch
in
range
(
epochs
):
for
epoch
in
range
(
epochs
):
loader
=
train_loader
cbks
.
on_epoch_begin
(
epoch
)
cbks
.
on_epoch_begin
(
epoch
)
logs
=
self
.
_run_one_epoch
(
loader
,
cbks
,
'train'
)
logs
=
self
.
_run_one_epoch
(
train_
loader
,
cbks
,
'train'
)
cbks
.
on_epoch_end
(
epoch
,
logs
)
cbks
.
on_epoch_end
(
epoch
,
logs
)
if
do_eval
and
epoch
%
eval_freq
==
0
:
if
do_eval
and
epoch
%
eval_freq
==
0
:
loader
=
eval_loader
eval_steps
=
self
.
_len_data_loader
(
loader
)
eval_steps
=
self
.
_len_data_loader
(
eval_
loader
)
cbks
.
on_begin
(
'eval'
,
{
cbks
.
on_begin
(
'eval'
,
{
'steps'
:
eval_steps
,
'steps'
:
eval_steps
,
'metrics_name'
:
self
.
_metrics_name
()
'metrics_name'
:
self
.
_metrics_name
()
})
})
logs
=
self
.
_run_one_epoch
(
loader
,
cbks
,
'eval'
)
logs
=
self
.
_run_one_epoch
(
eval_
loader
,
cbks
,
'eval'
)
cbks
.
on_end
(
'eval'
,
logs
)
cbks
.
on_end
(
'eval'
,
logs
)
...
@@ -1414,15 +1411,13 @@ class Model(fluid.dygraph.Layer):
...
@@ -1414,15 +1411,13 @@ class Model(fluid.dygraph.Layer):
verbose
=
verbose
,
verbose
=
verbose
,
metrics
=
self
.
_metrics_name
(),
)
metrics
=
self
.
_metrics_name
(),
)
loader
=
eval_loader
eval_steps
=
self
.
_len_data_loader
(
eval_loader
)
eval_steps
=
self
.
_len_data_loader
(
loader
)
cbks
.
on_begin
(
'eval'
,
{
cbks
.
on_begin
(
'eval'
,
{
'steps'
:
eval_steps
,
'steps'
:
eval_steps
,
'metrics_name'
:
self
.
_metrics_name
()
'metrics_name'
:
self
.
_metrics_name
()
})
})
logs
=
self
.
_run_one_epoch
(
loader
,
cbks
,
'eval'
)
logs
=
self
.
_run_one_epoch
(
eval_
loader
,
cbks
,
'eval'
)
cbks
.
on_end
(
'eval'
,
logs
)
cbks
.
on_end
(
'eval'
,
logs
)
...
@@ -1522,18 +1517,16 @@ class Model(fluid.dygraph.Layer):
...
@@ -1522,18 +1517,16 @@ class Model(fluid.dygraph.Layer):
self
.
_test_dataloader
=
test_loader
self
.
_test_dataloader
=
test_loader
loader
=
test_loader
cbks
=
config_callbacks
(
callbacks
,
model
=
self
,
verbose
=
1
)
cbks
=
config_callbacks
(
callbacks
,
model
=
self
,
verbose
=
1
)
test_steps
=
self
.
_len_data_loader
(
loader
)
test_steps
=
self
.
_len_data_loader
(
test_
loader
)
logs
=
{
'steps'
:
test_steps
}
logs
=
{
'steps'
:
test_steps
}
cbks
.
on_begin
(
'test'
,
logs
)
cbks
.
on_begin
(
'test'
,
logs
)
outputs
=
[]
outputs
=
[]
logs
,
outputs
=
self
.
_run_one_epoch
(
loader
,
cbks
,
'test'
)
logs
,
outputs
=
self
.
_run_one_epoch
(
test_
loader
,
cbks
,
'test'
)
outputs
=
list
(
zip
(
*
outputs
))
outputs
=
list
(
zip
(
*
outputs
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录