Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
0244a9db
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看板
提交
0244a9db
编写于
6月 17, 2020
作者:
C
chengmo
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'chengmo/fix_setup_print' into fix_setup_print
上级
191b52aa
707ca42d
变更
39
显示空白变更内容
内联
并排
Showing
39 changed file
with
138 addition
and
119 deletion
+138
-119
core/trainers/framework/dataset.py
core/trainers/framework/dataset.py
+3
-2
core/utils/dataloader_instance.py
core/utils/dataloader_instance.py
+7
-3
core/utils/envs.py
core/utils/envs.py
+22
-6
core/utils/util.py
core/utils/util.py
+33
-3
models/contentunderstanding/readme.md
models/contentunderstanding/readme.md
+2
-2
models/demo/movie_recommand/rank/config.yaml
models/demo/movie_recommand/rank/config.yaml
+1
-2
models/demo/movie_recommand/recall/config.yaml
models/demo/movie_recommand/recall/config.yaml
+1
-2
models/match/dssm/config.yaml
models/match/dssm/config.yaml
+1
-3
models/match/multiview-simnet/config.yaml
models/match/multiview-simnet/config.yaml
+1
-3
models/match/readme.md
models/match/readme.md
+1
-1
models/multitask/esmm/config.yaml
models/multitask/esmm/config.yaml
+35
-36
models/multitask/mmoe/config.yaml
models/multitask/mmoe/config.yaml
+1
-2
models/multitask/readme.md
models/multitask/readme.md
+1
-1
models/multitask/share-bottom/config.yaml
models/multitask/share-bottom/config.yaml
+1
-2
models/rank/afm/config.yaml
models/rank/afm/config.yaml
+1
-2
models/rank/dcn/config.yaml
models/rank/dcn/config.yaml
+1
-1
models/rank/deep_crossing/config.yaml
models/rank/deep_crossing/config.yaml
+1
-2
models/rank/deepfm/config.yaml
models/rank/deepfm/config.yaml
+1
-2
models/rank/din/config.yaml
models/rank/din/config.yaml
+1
-2
models/rank/ffm/config.yaml
models/rank/ffm/config.yaml
+1
-2
models/rank/fgcnn/config.yaml
models/rank/fgcnn/config.yaml
+1
-2
models/rank/fm/config.yaml
models/rank/fm/config.yaml
+1
-2
models/rank/fnn/config.yaml
models/rank/fnn/config.yaml
+1
-2
models/rank/logistic_regression/config.yaml
models/rank/logistic_regression/config.yaml
+1
-2
models/rank/nfm/config.yaml
models/rank/nfm/config.yaml
+1
-2
models/rank/pnn/config.yaml
models/rank/pnn/config.yaml
+1
-2
models/rank/readme.md
models/rank/readme.md
+1
-1
models/rank/wide_deep/config.yaml
models/rank/wide_deep/config.yaml
+1
-2
models/rank/xdeepfm/config.yaml
models/rank/xdeepfm/config.yaml
+1
-2
models/recall/gnn/config.yaml
models/recall/gnn/config.yaml
+1
-3
models/recall/gru4rec/config.yaml
models/recall/gru4rec/config.yaml
+1
-2
models/recall/ncf/config.yaml
models/recall/ncf/config.yaml
+1
-2
models/recall/readme.md
models/recall/readme.md
+1
-1
models/recall/ssr/config.yaml
models/recall/ssr/config.yaml
+1
-2
models/recall/word2vec/config.yaml
models/recall/word2vec/config.yaml
+1
-3
models/rerank/listwise/config.yaml
models/rerank/listwise/config.yaml
+1
-2
models/treebased/tdm/config.yaml
models/treebased/tdm/config.yaml
+1
-3
run.py
run.py
+4
-4
tools/build_script.sh
tools/build_script.sh
+1
-1
未找到文件。
core/trainers/framework/dataset.py
浏览文件 @
0244a9db
...
@@ -15,13 +15,13 @@
...
@@ -15,13 +15,13 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
os
import
os
import
warnings
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.utils
import
dataloader_instance
from
paddlerec.core.utils
import
dataloader_instance
from
paddlerec.core.reader
import
SlotReader
from
paddlerec.core.reader
import
SlotReader
from
paddlerec.core.trainer
import
EngineMode
from
paddlerec.core.trainer
import
EngineMode
from
paddlerec.core.utils.util
import
split_files
__all__
=
[
"DatasetBase"
,
"DataLoader"
,
"QueueDataset"
]
__all__
=
[
"DatasetBase"
,
"DataLoader"
,
"QueueDataset"
]
...
@@ -123,7 +123,8 @@ class QueueDataset(DatasetBase):
...
@@ -123,7 +123,8 @@ class QueueDataset(DatasetBase):
for
x
in
os
.
listdir
(
train_data_path
)
for
x
in
os
.
listdir
(
train_data_path
)
]
]
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
file_list
=
context
[
"fleet"
].
split_files
(
file_list
)
file_list
=
split_files
(
file_list
,
context
[
"fleet"
].
worker_index
(),
context
[
"fleet"
].
worker_num
())
dataset
.
set_filelist
(
file_list
)
dataset
.
set_filelist
(
file_list
)
for
model_dict
in
context
[
"phases"
]:
for
model_dict
in
context
[
"phases"
]:
...
...
core/utils/dataloader_instance.py
浏览文件 @
0244a9db
...
@@ -19,6 +19,7 @@ from paddlerec.core.utils.envs import get_global_env
...
@@ -19,6 +19,7 @@ from paddlerec.core.utils.envs import get_global_env
from
paddlerec.core.utils.envs
import
get_runtime_environ
from
paddlerec.core.utils.envs
import
get_runtime_environ
from
paddlerec.core.reader
import
SlotReader
from
paddlerec.core.reader
import
SlotReader
from
paddlerec.core.trainer
import
EngineMode
from
paddlerec.core.trainer
import
EngineMode
from
paddlerec.core.utils.util
import
split_files
def
dataloader_by_name
(
readerclass
,
def
dataloader_by_name
(
readerclass
,
...
@@ -39,7 +40,8 @@ def dataloader_by_name(readerclass,
...
@@ -39,7 +40,8 @@ def dataloader_by_name(readerclass,
files
=
[
str
(
data_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
data_path
)]
files
=
[
str
(
data_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
data_path
)]
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
files
=
context
[
"fleet"
].
split_files
(
files
)
files
=
split_files
(
files
,
context
[
"fleet"
].
worker_index
(),
context
[
"fleet"
].
worker_num
())
print
(
"file_list : {}"
.
format
(
files
))
print
(
"file_list : {}"
.
format
(
files
))
reader
=
reader_class
(
yaml_file
)
reader
=
reader_class
(
yaml_file
)
...
@@ -80,7 +82,8 @@ def slotdataloader_by_name(readerclass, dataset_name, yaml_file, context):
...
@@ -80,7 +82,8 @@ def slotdataloader_by_name(readerclass, dataset_name, yaml_file, context):
files
=
[
str
(
data_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
data_path
)]
files
=
[
str
(
data_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
data_path
)]
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
files
=
context
[
"fleet"
].
split_files
(
files
)
files
=
split_files
(
files
,
context
[
"fleet"
].
worker_index
(),
context
[
"fleet"
].
worker_num
())
print
(
"file_list: {}"
.
format
(
files
))
print
(
"file_list: {}"
.
format
(
files
))
sparse
=
get_global_env
(
name
+
"sparse_slots"
,
"#"
)
sparse
=
get_global_env
(
name
+
"sparse_slots"
,
"#"
)
...
@@ -133,7 +136,8 @@ def slotdataloader(readerclass, train, yaml_file, context):
...
@@ -133,7 +136,8 @@ def slotdataloader(readerclass, train, yaml_file, context):
files
=
[
str
(
data_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
data_path
)]
files
=
[
str
(
data_path
)
+
"/%s"
%
x
for
x
in
os
.
listdir
(
data_path
)]
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
if
context
[
"engine"
]
==
EngineMode
.
LOCAL_CLUSTER
:
files
=
context
[
"fleet"
].
split_files
(
files
)
files
=
split_files
(
files
,
context
[
"fleet"
].
worker_index
(),
context
[
"fleet"
].
worker_num
())
print
(
"file_list: {}"
.
format
(
files
))
print
(
"file_list: {}"
.
format
(
files
))
sparse
=
get_global_env
(
"sparse_slots"
,
"#"
,
namespace
)
sparse
=
get_global_env
(
"sparse_slots"
,
"#"
,
namespace
)
...
...
core/utils/envs.py
浏览文件 @
0244a9db
...
@@ -18,7 +18,9 @@ import copy
...
@@ -18,7 +18,9 @@ import copy
import
os
import
os
import
socket
import
socket
import
sys
import
sys
import
six
import
traceback
import
traceback
import
six
global_envs
=
{}
global_envs
=
{}
global_envs_flatten
=
{}
global_envs_flatten
=
{}
...
@@ -101,6 +103,12 @@ def set_global_envs(envs):
...
@@ -101,6 +103,12 @@ def set_global_envs(envs):
name
=
"."
.
join
([
"dataset"
,
dataset
[
"name"
],
"type"
])
name
=
"."
.
join
([
"dataset"
,
dataset
[
"name"
],
"type"
])
global_envs
[
name
]
=
"DataLoader"
global_envs
[
name
]
=
"DataLoader"
if
get_platform
()
==
"LINUX"
and
six
.
PY3
:
print
(
"QueueDataset can not support PY3, change to DataLoader"
)
for
dataset
in
envs
[
"dataset"
]:
name
=
"."
.
join
([
"dataset"
,
dataset
[
"name"
],
"type"
])
global_envs
[
name
]
=
"DataLoader"
def
get_global_env
(
env_name
,
default_value
=
None
,
namespace
=
None
):
def
get_global_env
(
env_name
,
default_value
=
None
,
namespace
=
None
):
"""
"""
...
@@ -253,11 +261,19 @@ def load_yaml(config):
...
@@ -253,11 +261,19 @@ def load_yaml(config):
use_full_loader
=
False
use_full_loader
=
False
if
os
.
path
.
isfile
(
config
):
if
os
.
path
.
isfile
(
config
):
if
six
.
PY2
:
with
open
(
config
,
'r'
)
as
rb
:
with
open
(
config
,
'r'
)
as
rb
:
if
use_full_loader
:
if
use_full_loader
:
_config
=
yaml
.
load
(
rb
.
read
(),
Loader
=
yaml
.
FullLoader
)
_config
=
yaml
.
load
(
rb
.
read
(),
Loader
=
yaml
.
FullLoader
)
else
:
else
:
_config
=
yaml
.
load
(
rb
.
read
())
_config
=
yaml
.
load
(
rb
.
read
())
return
_config
return
_config
else
:
with
open
(
config
,
'r'
,
encoding
=
"utf-8"
)
as
rb
:
if
use_full_loader
:
_config
=
yaml
.
load
(
rb
.
read
(),
Loader
=
yaml
.
FullLoader
)
else
:
_config
=
yaml
.
load
(
rb
.
read
())
return
_config
else
:
else
:
raise
ValueError
(
"config {} can not be supported"
.
format
(
config
))
raise
ValueError
(
"config {} can not be supported"
.
format
(
config
))
core/utils/util.py
浏览文件 @
0244a9db
...
@@ -19,11 +19,8 @@ import time
...
@@ -19,11 +19,8 @@ import time
import
numpy
as
np
import
numpy
as
np
from
paddle
import
fluid
from
paddle
import
fluid
from
paddlerec.core.utils
import
fs
as
fs
def
save_program_proto
(
path
,
program
=
None
):
def
save_program_proto
(
path
,
program
=
None
):
if
program
is
None
:
if
program
is
None
:
_program
=
fluid
.
default_main_program
()
_program
=
fluid
.
default_main_program
()
else
:
else
:
...
@@ -171,6 +168,39 @@ def print_cost(cost, params):
...
@@ -171,6 +168,39 @@ def print_cost(cost, params):
return
log_str
return
log_str
def
split_files
(
files
,
trainer_id
,
trainers
):
"""
split files before distributed training,
example 1: files is [a, b, c ,d, e] and trainer_num = 2, then trainer
0 gets [a, b, c] and trainer 1 gets [d, e].
example 2: files is [a, b], and trainer_num = 3, then trainer 0 gets
[a], trainer 1 gets [b], trainer 2 gets []
Args:
files(list): file list need to be read.
Returns:
list: files belongs to this worker.
"""
if
not
isinstance
(
files
,
list
):
raise
TypeError
(
"files should be a list of file need to be read."
)
remainder
=
len
(
files
)
%
trainers
blocksize
=
int
(
len
(
files
)
/
trainers
)
blocks
=
[
blocksize
]
*
trainers
for
i
in
range
(
remainder
):
blocks
[
i
]
+=
1
trainer_files
=
[[]]
*
trainers
begin
=
0
for
i
in
range
(
trainers
):
trainer_files
[
i
]
=
files
[
begin
:
begin
+
blocks
[
i
]]
begin
+=
blocks
[
i
]
return
trainer_files
[
trainer_id
]
class
CostPrinter
(
object
):
class
CostPrinter
(
object
):
"""
"""
For count cost time && print cost log
For count cost time && print cost log
...
...
models/contentunderstanding/readme.md
浏览文件 @
0244a9db
...
@@ -86,7 +86,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
...
@@ -86,7 +86,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml,mode配置infer_runner
# 修改对应模型的config.yaml,mode配置infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# infer_runner中 class配置为 class:
single_
infer
# infer_runner中 class配置为 class: infer
# 修改phase阶段为infer的配置,参照config注释
# 修改phase阶段为infer的配置,参照config注释
# 修改完config.yaml后 执行:
# 修改完config.yaml后 执行:
...
@@ -106,7 +106,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
...
@@ -106,7 +106,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml,mode配置infer_runner
# 修改对应模型的config.yaml,mode配置infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# infer_runner中 class配置为 class:
single_
infer
# infer_runner中 class配置为 class: infer
# 修改phase阶段为infer的配置,参照config注释
# 修改phase阶段为infer的配置,参照config注释
# 修改完config.yaml后 执行:
# 修改完config.yaml后 执行:
...
...
models/demo/movie_recommand/rank/config.yaml
浏览文件 @
0244a9db
...
@@ -64,8 +64,7 @@ runner:
...
@@ -64,8 +64,7 @@ runner:
device
:
cpu
device
:
cpu
-
name
:
runner_infer
-
name
:
runner_infer
epochs
:
1
class
:
infer
class
:
single_infer
print_interval
:
10000
print_interval
:
10000
init_model_path
:
"
increment/9"
# load model path
init_model_path
:
"
increment/9"
# load model path
...
...
models/demo/movie_recommand/recall/config.yaml
浏览文件 @
0244a9db
...
@@ -64,8 +64,7 @@ runner:
...
@@ -64,8 +64,7 @@ runner:
device
:
cpu
device
:
cpu
-
name
:
runner_infer
-
name
:
runner_infer
epochs
:
1
class
:
infer
class
:
single_infer
print_interval
:
10000
print_interval
:
10000
init_model_path
:
"
increment/9"
# load model path
init_model_path
:
"
increment/9"
# load model path
...
...
models/match/dssm/config.yaml
浏览文件 @
0244a9db
...
@@ -56,9 +56,7 @@ runner:
...
@@ -56,9 +56,7 @@ runner:
init_model_path
:
"
"
# load model path
init_model_path
:
"
"
# load model path
print_interval
:
2
print_interval
:
2
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
# num of epochs
epochs
:
1
# device to run training or infer
# device to run training or infer
device
:
cpu
device
:
cpu
print_interval
:
1
print_interval
:
1
...
...
models/match/multiview-simnet/config.yaml
浏览文件 @
0244a9db
...
@@ -63,9 +63,7 @@ runner:
...
@@ -63,9 +63,7 @@ runner:
init_model_path
:
"
"
# load model path
init_model_path
:
"
"
# load model path
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
# num of epochs
epochs
:
1
# device to run training or infer
# device to run training or infer
device
:
cpu
device
:
cpu
print_interval
:
1
print_interval
:
1
...
...
models/match/readme.md
浏览文件 @
0244a9db
...
@@ -43,7 +43,7 @@ python -m paddlerec.run -m paddlerec.models.match.multiview-simnet # multiview-s
...
@@ -43,7 +43,7 @@ python -m paddlerec.run -m paddlerec.models.match.multiview-simnet # multiview-s
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml,mode配置infer_runner
# 修改对应模型的config.yaml,mode配置infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# infer_runner中 class配置为 class:
single_
infer
# infer_runner中 class配置为 class: infer
# 修改phase阶段为infer的配置,参照config注释
# 修改phase阶段为infer的配置,参照config注释
# 修改完config.yaml后 执行:
# 修改完config.yaml后 执行:
...
...
models/multitask/esmm/config.yaml
浏览文件 @
0244a9db
...
@@ -16,12 +16,12 @@
...
@@ -16,12 +16,12 @@
workspace
:
"
paddlerec.models.multitask.esmm"
workspace
:
"
paddlerec.models.multitask.esmm"
dataset
:
dataset
:
-
name
:
dataset_train
-
name
:
dataset_train
batch_size
:
1
batch_size
:
1
type
:
QueueDataset
type
:
QueueDataset
data_path
:
"
{workspace}/data/train"
data_path
:
"
{workspace}/data/train"
data_converter
:
"
{workspace}/esmm_reader.py"
data_converter
:
"
{workspace}/esmm_reader.py"
-
name
:
dataset_infer
-
name
:
dataset_infer
batch_size
:
1
batch_size
:
1
type
:
QueueDataset
type
:
QueueDataset
data_path
:
"
{workspace}/data/test"
data_path
:
"
{workspace}/data/test"
...
@@ -39,7 +39,7 @@ hyper_parameters:
...
@@ -39,7 +39,7 @@ hyper_parameters:
mode
:
[
train_runner
,
infer_runner
]
mode
:
[
train_runner
,
infer_runner
]
runner
:
runner
:
-
name
:
train_runner
-
name
:
train_runner
class
:
train
class
:
train
device
:
cpu
device
:
cpu
epochs
:
3
epochs
:
3
...
@@ -49,20 +49,19 @@ runner:
...
@@ -49,20 +49,19 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
10
print_interval
:
10
phases
:
[
train
]
phases
:
[
train
]
-
name
:
infer_runner
-
name
:
infer_runner
class
:
infer
class
:
infer
init_model_path
:
"
increment/0
"
init_model_path
:
"
increment/1
"
device
:
cpu
device
:
cpu
epochs
:
1
print_interval
:
1
print_interval
:
1
phases
:
[
infer
]
phases
:
[
infer
]
phase
:
phase
:
-
name
:
train
-
name
:
train
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
models/multitask/mmoe/config.yaml
浏览文件 @
0244a9db
...
@@ -52,10 +52,9 @@ runner:
...
@@ -52,10 +52,9 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
10
print_interval
:
10
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
device
:
cpu
device
:
cpu
epochs
:
3
phase
:
phase
:
-
name
:
train
-
name
:
train
...
...
models/multitask/readme.md
浏览文件 @
0244a9db
...
@@ -77,7 +77,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
...
@@ -77,7 +77,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml,mode配置infer_runner
# 修改对应模型的config.yaml,mode配置infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# infer_runner中 class配置为 class:
single_
infer
# infer_runner中 class配置为 class: infer
# 修改phase阶段为infer的配置,参照config注释
# 修改phase阶段为infer的配置,参照config注释
# 修改完config.yaml后 执行:
# 修改完config.yaml后 执行:
...
...
models/multitask/share-bottom/config.yaml
浏览文件 @
0244a9db
...
@@ -51,10 +51,9 @@ runner:
...
@@ -51,10 +51,9 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
5
print_interval
:
5
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
device
:
cpu
device
:
cpu
epochs
:
3
phase
:
phase
:
-
name
:
train
-
name
:
train
...
...
models/rank/afm/config.yaml
浏览文件 @
0244a9db
...
@@ -59,8 +59,7 @@ runner:
...
@@ -59,8 +59,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/dcn/config.yaml
浏览文件 @
0244a9db
...
@@ -60,7 +60,7 @@ runner:
...
@@ -60,7 +60,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
epochs
:
1
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
...
...
models/rank/deep_crossing/config.yaml
浏览文件 @
0244a9db
...
@@ -58,8 +58,7 @@ runner:
...
@@ -58,8 +58,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/deepfm/config.yaml
浏览文件 @
0244a9db
...
@@ -58,8 +58,7 @@ runner:
...
@@ -58,8 +58,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/din/config.yaml
浏览文件 @
0244a9db
...
@@ -56,8 +56,7 @@ runner:
...
@@ -56,8 +56,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/ffm/config.yaml
浏览文件 @
0244a9db
...
@@ -57,8 +57,7 @@ runner:
...
@@ -57,8 +57,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/fgcnn/config.yaml
浏览文件 @
0244a9db
...
@@ -62,8 +62,7 @@ runner:
...
@@ -62,8 +62,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/fm/config.yaml
浏览文件 @
0244a9db
...
@@ -57,8 +57,7 @@ runner:
...
@@ -57,8 +57,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/fnn/config.yaml
浏览文件 @
0244a9db
...
@@ -68,8 +68,7 @@ runner:
...
@@ -68,8 +68,7 @@ runner:
save_inference_path
:
"
inference_fnn"
save_inference_path
:
"
inference_fnn"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
trainer_class
:
single_infer
trainer_class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/logistic_regression/config.yaml
浏览文件 @
0244a9db
...
@@ -56,8 +56,7 @@ runner:
...
@@ -56,8 +56,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/nfm/config.yaml
浏览文件 @
0244a9db
...
@@ -63,8 +63,7 @@ runner:
...
@@ -63,8 +63,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/pnn/config.yaml
浏览文件 @
0244a9db
...
@@ -60,8 +60,7 @@ runner:
...
@@ -60,8 +60,7 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
print_interval
:
1
print_interval
:
1
...
...
models/rank/readme.md
浏览文件 @
0244a9db
...
@@ -98,7 +98,7 @@ python -m paddlerec.run -m ./config.yaml
...
@@ -98,7 +98,7 @@ python -m paddlerec.run -m ./config.yaml
```
```
# 修改对应模型的config.yaml,mode配置infer_runner
# 修改对应模型的config.yaml,mode配置infer_runner
# 示例: mode: runner1 -> mode: infer_runner
# 示例: mode: runner1 -> mode: infer_runner
# infer_runner中 class配置为 class:
single_
infer
# infer_runner中 class配置为 class: infer
# 如果训练阶段和预测阶段的模型输入一致,phase不需要改动,复用train的即可
# 如果训练阶段和预测阶段的模型输入一致,phase不需要改动,复用train的即可
# 修改完config.yaml后 执行:
# 修改完config.yaml后 执行:
...
...
models/rank/wide_deep/config.yaml
浏览文件 @
0244a9db
...
@@ -54,8 +54,7 @@ runner:
...
@@ -54,8 +54,7 @@ runner:
save_checkpoint_path
:
"
increment"
save_checkpoint_path
:
"
increment"
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
...
...
models/rank/xdeepfm/config.yaml
浏览文件 @
0244a9db
...
@@ -55,8 +55,7 @@ runner:
...
@@ -55,8 +55,7 @@ runner:
save_checkpoint_path
:
"
increment"
save_checkpoint_path
:
"
increment"
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
epochs
:
1
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
...
...
models/recall/gnn/config.yaml
浏览文件 @
0244a9db
...
@@ -61,9 +61,7 @@ runner:
...
@@ -61,9 +61,7 @@ runner:
init_model_path
:
"
"
# load model path
init_model_path
:
"
"
# load model path
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
# num of epochs
epochs
:
1
# device to run training or infer
# device to run training or infer
device
:
cpu
device
:
cpu
print_interval
:
1
print_interval
:
1
...
...
models/recall/gru4rec/config.yaml
浏览文件 @
0244a9db
...
@@ -54,10 +54,9 @@ runner:
...
@@ -54,10 +54,9 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
10
print_interval
:
10
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
device
:
cpu
device
:
cpu
epochs
:
1
phase
:
phase
:
-
name
:
train
-
name
:
train
...
...
models/recall/ncf/config.yaml
浏览文件 @
0244a9db
...
@@ -51,10 +51,9 @@ runner:
...
@@ -51,10 +51,9 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
10
print_interval
:
10
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
device
:
cpu
device
:
cpu
epochs
:
1
phase
:
phase
:
-
name
:
train
-
name
:
train
...
...
models/recall/readme.md
浏览文件 @
0244a9db
...
@@ -95,7 +95,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
...
@@ -95,7 +95,7 @@ python -m paddlerec.run -m ./config.yaml # 自定义修改超参后,指定配
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml, workspace配置为当前目录的绝对路径
# 修改对应模型的config.yaml,mode配置infer_runner
# 修改对应模型的config.yaml,mode配置infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# 示例: mode: train_runner -> mode: infer_runner
# infer_runner中 class配置为 class:
single_
infer
# infer_runner中 class配置为 class: infer
# 修改phase阶段为infer的配置,参照config注释
# 修改phase阶段为infer的配置,参照config注释
# 修改完config.yaml后 执行:
# 修改完config.yaml后 执行:
...
...
models/recall/ssr/config.yaml
浏览文件 @
0244a9db
...
@@ -50,10 +50,9 @@ runner:
...
@@ -50,10 +50,9 @@ runner:
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
print_interval
:
10
print_interval
:
10
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
device
:
cpu
device
:
cpu
epochs
:
1
phase
:
phase
:
-
name
:
train
-
name
:
train
...
...
models/recall/word2vec/config.yaml
浏览文件 @
0244a9db
...
@@ -61,9 +61,7 @@ runner:
...
@@ -61,9 +61,7 @@ runner:
init_model_path
:
"
"
# load model path
init_model_path
:
"
"
# load model path
print_interval
:
1
print_interval
:
1
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_infer
class
:
infer
# num of epochs
epochs
:
1
# device to run training or infer
# device to run training or infer
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
# load model path
init_model_path
:
"
increment/0"
# load model path
...
...
models/rerank/listwise/config.yaml
浏览文件 @
0244a9db
...
@@ -51,10 +51,9 @@ runner:
...
@@ -51,10 +51,9 @@ runner:
save_checkpoint_path
:
"
increment"
save_checkpoint_path
:
"
increment"
save_inference_path
:
"
inference"
save_inference_path
:
"
inference"
-
name
:
infer_runner
-
name
:
infer_runner
class
:
single_
infer
class
:
infer
init_model_path
:
"
increment/0"
init_model_path
:
"
increment/0"
device
:
cpu
device
:
cpu
epochs
:
3
phase
:
phase
:
-
name
:
train
-
name
:
train
...
...
models/treebased/tdm/config.yaml
浏览文件 @
0244a9db
...
@@ -80,10 +80,8 @@ runner:
...
@@ -80,10 +80,8 @@ runner:
print_interval
:
10
print_interval
:
10
-
name
:
runner2
-
name
:
runner2
class
:
single_
infer
class
:
infer
startup_class_path
:
"
{workspace}/tdm_startup.py"
startup_class_path
:
"
{workspace}/tdm_startup.py"
# num of epochs
epochs
:
1
# device to run training or infer
# device to run training or infer
device
:
cpu
device
:
cpu
init_model_path
:
"
increment/0"
# load model path
init_model_path
:
"
increment/0"
# load model path
...
...
run.py
浏览文件 @
0244a9db
...
@@ -139,7 +139,7 @@ def get_engine(args, running_config, mode):
...
@@ -139,7 +139,7 @@ def get_engine(args, running_config, mode):
engine
=
"LOCAL_CLUSTER_TRAIN"
engine
=
"LOCAL_CLUSTER_TRAIN"
if
engine
not
in
engine_choices
:
if
engine
not
in
engine_choices
:
raise
ValueError
(
"{} can
not
be chosen in {}"
.
format
(
engine_class
,
raise
ValueError
(
"{} can
only
be chosen in {}"
.
format
(
engine_class
,
engine_choices
))
engine_choices
))
run_engine
=
engines
[
transpiler
].
get
(
engine
,
None
)
run_engine
=
engines
[
transpiler
].
get
(
engine
,
None
)
...
@@ -439,8 +439,8 @@ def local_cluster_engine(args):
...
@@ -439,8 +439,8 @@ def local_cluster_engine(args):
if
fleet_mode
==
"COLLECTIVE"
:
if
fleet_mode
==
"COLLECTIVE"
:
cluster_envs
[
"selected_gpus"
]
=
selected_gpus
cluster_envs
[
"selected_gpus"
]
=
selected_gpus
gpus
=
selected_gpus
.
split
(
","
)
gpus
=
selected_gpus
.
split
(
","
)
gpu
_num
=
get_worker_num
(
run_extras
,
len
(
gpus
))
worker
_num
=
get_worker_num
(
run_extras
,
len
(
gpus
))
cluster_envs
[
"selected_gpus"
]
=
','
.
join
(
gpus
[:
gpu
_num
])
cluster_envs
[
"selected_gpus"
]
=
','
.
join
(
gpus
[:
worker
_num
])
cluster_envs
[
"server_num"
]
=
server_num
cluster_envs
[
"server_num"
]
=
server_num
cluster_envs
[
"worker_num"
]
=
worker_num
cluster_envs
[
"worker_num"
]
=
worker_num
...
...
tools/build_script.sh
浏览文件 @
0244a9db
...
@@ -49,7 +49,7 @@ function model_test() {
...
@@ -49,7 +49,7 @@ function model_test() {
root_dir
=
`
pwd
`
root_dir
=
`
pwd
`
all_model
=
$(
find
${
root_dir
}
-name
config.yaml
)
all_model
=
$(
find
${
root_dir
}
-name
config.yaml
)
special_models
=(
"demo"
"pnn"
"fgcnn"
"
esmm
"
)
special_models
=(
"demo"
"pnn"
"fgcnn"
"
gru4rec"
"tagspace
"
)
for
model
in
${
all_model
}
for
model
in
${
all_model
}
do
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录