Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
de7b6548
P
PaddleRec
项目概览
BaiXuePrincess
/
PaddleRec
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleRec
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
de7b6548
编写于
8月 10, 2020
作者:
F
frankwhzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add logging for info
上级
b5e95a80
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
8 addition
and
9 deletion
+8
-9
core/trainers/framework/runner.py
core/trainers/framework/runner.py
+8
-9
未找到文件。
core/trainers/framework/runner.py
浏览文件 @
de7b6548
...
@@ -17,12 +17,15 @@ from __future__ import print_function
...
@@ -17,12 +17,15 @@ from __future__ import print_function
import
os
import
os
import
time
import
time
import
numpy
as
np
import
numpy
as
np
from
datetime
import
datetime
import
logging
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
paddlerec.core.utils
import
envs
from
paddlerec.core.utils
import
envs
from
paddlerec.core.metric
import
Metric
from
paddlerec.core.metric
import
Metric
logging
.
basicConfig
(
format
=
'%(asctime)s - %(levelname)s: %(message)s'
,
level
=
logging
.
INFO
)
__all__
=
[
__all__
=
[
"RunnerBase"
,
"SingleRunner"
,
"PSRunner"
,
"CollectiveRunner"
,
"PslibRunner"
"RunnerBase"
,
"SingleRunner"
,
"PSRunner"
,
"CollectiveRunner"
,
"PslibRunner"
]
]
...
@@ -142,9 +145,9 @@ class RunnerBase(object):
...
@@ -142,9 +145,9 @@ class RunnerBase(object):
metrics_format
=
[]
metrics_format
=
[]
if
context
[
"is_infer"
]:
if
context
[
"is_infer"
]:
metrics_format
.
append
(
"
{{}}
\t
[Infer]
\t
{}: {{}}"
.
format
(
"batch"
))
metrics_format
.
append
(
"
\t
[Infer]
\t
{}: {{}}"
.
format
(
"batch"
))
else
:
else
:
metrics_format
.
append
(
"
{{}}
\t
[Train]
\t
{}: {{}}"
.
format
(
"batch"
))
metrics_format
.
append
(
"
\t
[Train]
\t
{}: {{}}"
.
format
(
"batch"
))
metrics_format
.
append
(
"{}: {{:.2f}}s"
.
format
(
"time_each_interval"
))
metrics_format
.
append
(
"{}: {{:.2f}}s"
.
format
(
"time_each_interval"
))
...
@@ -170,10 +173,7 @@ class RunnerBase(object):
...
@@ -170,10 +173,7 @@ class RunnerBase(object):
return_numpy
=
False
)
return_numpy
=
False
)
if
batch_id
%
fetch_period
==
0
and
batch_id
!=
0
:
if
batch_id
%
fetch_period
==
0
and
batch_id
!=
0
:
metrics
=
[
metrics
=
[
batch_id
]
datetime
.
now
().
strftime
(
'%Y-%m-%d %H:%M:%S'
)
]
metrics
.
extend
([
batch_id
])
end_time
=
time
.
time
()
end_time
=
time
.
time
()
seconds
=
end_time
-
begin_time
seconds
=
end_time
-
begin_time
metrics
.
extend
([
seconds
])
metrics
.
extend
([
seconds
])
...
@@ -184,8 +184,7 @@ class RunnerBase(object):
...
@@ -184,8 +184,7 @@ class RunnerBase(object):
for
metrics_tensor
in
metrics_tensors
for
metrics_tensor
in
metrics_tensors
]
]
metrics
.
extend
(
metrics_rets
)
metrics
.
extend
(
metrics_rets
)
logging
.
info
(
metrics_format
.
format
(
*
metrics
))
print
(
metrics_format
.
format
(
*
metrics
))
batch_id
+=
1
batch_id
+=
1
except
fluid
.
core
.
EOFException
:
except
fluid
.
core
.
EOFException
:
reader
.
reset
()
reader
.
reset
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录