Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
e8261156
P
PaddleRec
项目概览
PaddlePaddle
/
PaddleRec
通知
68
Star
12
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
27
列表
看板
标记
里程碑
合并请求
10
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
27
Issue
27
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e8261156
编写于
8月 04, 2020
作者:
F
frankwhzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix dataloader log print
上级
6ad48d7d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
33 addition
and
18 deletion
+33
-18
core/trainers/framework/runner.py
core/trainers/framework/runner.py
+25
-8
models/multitask/mmoe/config.yaml
models/multitask/mmoe/config.yaml
+8
-10
未找到文件。
core/trainers/framework/runner.py
浏览文件 @
e8261156
...
@@ -17,6 +17,7 @@ from __future__ import print_function
...
@@ -17,6 +17,7 @@ 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
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
paddlerec.core.utils
import
envs
from
paddlerec.core.utils
import
envs
...
@@ -137,7 +138,14 @@ class RunnerBase(object):
...
@@ -137,7 +138,14 @@ class RunnerBase(object):
metrics_varnames
=
[]
metrics_varnames
=
[]
metrics_format
=
[]
metrics_format
=
[]
metrics_format
.
append
(
"{}: {{}}"
.
format
(
"batch"
))
if
context
[
"is_infer"
]:
metrics_format
.
append
(
"{{}}
\t
[Infer]
\t
{}: {{}}"
.
format
(
"batch"
))
else
:
metrics_format
.
append
(
"{{}}
\t
[Train]
\t
{}: {{}}"
.
format
(
"batch"
))
metrics_format
.
append
(
"{}: {{:.2f}}s"
.
format
(
"time_each_interval"
))
for
name
,
var
in
metrics
.
items
():
for
name
,
var
in
metrics
.
items
():
metrics_varnames
.
append
(
var
.
name
)
metrics_varnames
.
append
(
var
.
name
)
metrics_format
.
append
(
"{}: {{}}"
.
format
(
name
))
metrics_format
.
append
(
"{}: {{}}"
.
format
(
name
))
...
@@ -146,6 +154,7 @@ class RunnerBase(object):
...
@@ -146,6 +154,7 @@ class RunnerBase(object):
reader
=
context
[
"model"
][
model_dict
[
"name"
]][
"model"
].
_data_loader
reader
=
context
[
"model"
][
model_dict
[
"name"
]][
"model"
].
_data_loader
reader
.
start
()
reader
.
start
()
batch_id
=
0
batch_id
=
0
begin_time
=
time
.
time
()
scope
=
context
[
"model"
][
model_name
][
"scope"
]
scope
=
context
[
"model"
][
model_name
][
"scope"
]
with
fluid
.
scope_guard
(
scope
):
with
fluid
.
scope_guard
(
scope
):
try
:
try
:
...
@@ -154,7 +163,16 @@ class RunnerBase(object):
...
@@ -154,7 +163,16 @@ class RunnerBase(object):
program
=
program
,
program
=
program
,
fetch_list
=
metrics_varnames
,
fetch_list
=
metrics_varnames
,
return_numpy
=
False
)
return_numpy
=
False
)
metrics
=
[
batch_id
]
if
batch_id
%
fetch_period
==
0
and
batch_id
!=
0
:
metrics
=
[
datetime
.
now
().
strftime
(
'%Y-%m-%d %H:%M:%S'
)
]
metrics
.
extend
([
batch_id
])
end_time
=
time
.
time
()
seconds
=
end_time
-
begin_time
metrics
.
extend
([
seconds
])
begin_time
=
end_time
metrics_rets
=
[
metrics_rets
=
[
as_numpy
(
metrics_tensor
)
as_numpy
(
metrics_tensor
)
...
@@ -162,7 +180,6 @@ class RunnerBase(object):
...
@@ -162,7 +180,6 @@ class RunnerBase(object):
]
]
metrics
.
extend
(
metrics_rets
)
metrics
.
extend
(
metrics_rets
)
if
batch_id
%
fetch_period
==
0
and
batch_id
!=
0
:
print
(
metrics_format
.
format
(
*
metrics
))
print
(
metrics_format
.
format
(
*
metrics
))
batch_id
+=
1
batch_id
+=
1
except
fluid
.
core
.
EOFException
:
except
fluid
.
core
.
EOFException
:
...
...
models/multitask/mmoe/config.yaml
浏览文件 @
e8261156
...
@@ -17,12 +17,12 @@ workspace: "paddlerec.models.multitask.mmoe"
...
@@ -17,12 +17,12 @@ workspace: "paddlerec.models.multitask.mmoe"
dataset
:
dataset
:
-
name
:
dataset_train
-
name
:
dataset_train
batch_size
:
1
batch_size
:
1
type
:
QueueDataset
type
:
DataLoader
# or
QueueDataset
data_path
:
"
{workspace}/data/train"
data_path
:
"
{workspace}/data/train"
data_converter
:
"
{workspace}/census_reader.py"
data_converter
:
"
{workspace}/census_reader.py"
-
name
:
dataset_infer
-
name
:
dataset_infer
batch_size
:
1
batch_size
:
1
type
:
QueueDataset
type
:
DataLoader
# or
QueueDataset
data_path
:
"
{workspace}/data/train"
data_path
:
"
{workspace}/data/train"
data_converter
:
"
{workspace}/census_reader.py"
data_converter
:
"
{workspace}/census_reader.py"
...
@@ -37,9 +37,7 @@ hyper_parameters:
...
@@ -37,9 +37,7 @@ hyper_parameters:
learning_rate
:
0.001
learning_rate
:
0.001
strategy
:
async
strategy
:
async
#use infer_runner mode and modify 'phase' below if infer
mode
:
[
train_runner
,
infer_runner
]
mode
:
train_runner
#mode: infer_runner
runner
:
runner
:
-
name
:
train_runner
-
name
:
train_runner
...
@@ -53,7 +51,7 @@ runner:
...
@@ -53,7 +51,7 @@ runner:
print_interval
:
10
print_interval
:
10
-
name
:
infer_runner
-
name
:
infer_runner
class
:
infer
class
:
infer
init_model_path
:
"
increment/
0
"
init_model_path
:
"
increment/
1
"
device
:
cpu
device
:
cpu
phase
:
phase
:
...
@@ -61,7 +59,7 @@ phase:
...
@@ -61,7 +59,7 @@ phase:
model
:
"
{workspace}/model.py"
model
:
"
{workspace}/model.py"
dataset_name
:
dataset_train
dataset_name
:
dataset_train
thread_num
:
1
thread_num
:
1
#
- name: infer
-
name
:
infer
#
model: "{workspace}/model.py"
model
:
"
{workspace}/model.py"
#
dataset_name: dataset_infer
dataset_name
:
dataset_infer
#
thread_num: 1
thread_num
:
1
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录