Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
7f99ff03
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看板
提交
7f99ff03
编写于
4月 14, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code clean
上级
33edc01a
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
25 addition
and
27 deletion
+25
-27
fleetrec/examples/ctr-dnn_train_single.yaml
fleetrec/examples/ctr-dnn_train_single.yaml
+1
-7
fleetrec/examples/train.py
fleetrec/examples/train.py
+1
-1
fleetrec/reader/data_loader.py
fleetrec/reader/data_loader.py
+0
-13
fleetrec/reader/reader.py
fleetrec/reader/reader.py
+14
-0
fleetrec/reader/reader_instance.py
fleetrec/reader/reader_instance.py
+5
-3
fleetrec/trainer/factory.py
fleetrec/trainer/factory.py
+2
-2
fleetrec/trainer/trainer.py
fleetrec/trainer/trainer.py
+1
-0
fleetrec/trainer/transpiler_trainer.py
fleetrec/trainer/transpiler_trainer.py
+1
-1
未找到文件。
fleetrec/examples/ctr-dnn_train_single.yaml
浏览文件 @
7f99ff03
...
@@ -29,11 +29,7 @@ train:
...
@@ -29,11 +29,7 @@ train:
epochs
:
10
epochs
:
10
trainer
:
"
SingleTraining"
trainer
:
"
SingleTraining"
strategy
:
mode
:
"
async"
reader
:
reader
:
mode
:
"
dataset"
batch_size
:
2
batch_size
:
2
pipe_command
:
"
python
/paddle/eleps/fleetrec/models/ctr_dnn/dataset.py"
pipe_command
:
"
python
/paddle/eleps/fleetrec/models/ctr_dnn/dataset.py"
train_data_path
:
"
/paddle/eleps/fleetrec/models/ctr_dnn/data/train"
train_data_path
:
"
/paddle/eleps/fleetrec/models/ctr_dnn/data/train"
...
@@ -56,8 +52,6 @@ train:
...
@@ -56,8 +52,6 @@ train:
inference
:
inference
:
dirname
:
"
models_for_inference"
dirname
:
"
models_for_inference"
epoch_interval
:
4
epoch_interval
:
4
feed_varnames
:
[
"
C1"
,
"
C2"
,
"
C3"
]
fetch_varnames
:
"
predict"
save_last
:
True
save_last
:
True
evaluate
:
evaluate
:
...
...
fleetrec/examples/train.py
浏览文件 @
7f99ff03
...
@@ -31,6 +31,6 @@ from fleetrec.trainer.factory import TrainerFactory
...
@@ -31,6 +31,6 @@ from fleetrec.trainer.factory import TrainerFactory
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
abs_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
abs_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
yaml
=
os
.
path
.
join
(
abs_dir
,
'ctr-dnn_train_
cluster
.yaml'
)
yaml
=
os
.
path
.
join
(
abs_dir
,
'ctr-dnn_train_
single
.yaml'
)
trainer
=
TrainerFactory
.
create
(
yaml
)
trainer
=
TrainerFactory
.
create
(
yaml
)
trainer
.
run
()
trainer
.
run
()
fleetrec/reader/data_loader.py
已删除
100644 → 0
浏览文件 @
33edc01a
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
fleetrec/reader/reader.py
浏览文件 @
7f99ff03
...
@@ -14,13 +14,27 @@
...
@@ -14,13 +14,27 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
abc
import
abc
import
os
import
paddle.fluid.incubate.data_generator
as
dg
import
paddle.fluid.incubate.data_generator
as
dg
import
yaml
from
fleetrec.utils
import
envs
class
Reader
(
dg
.
MultiSlotDataGenerator
):
class
Reader
(
dg
.
MultiSlotDataGenerator
):
__metaclass__
=
abc
.
ABCMeta
__metaclass__
=
abc
.
ABCMeta
def
__init__
(
self
,
config
):
super
().
__init__
()
if
os
.
path
.
exists
(
config
)
and
os
.
path
.
isfile
(
config
):
with
open
(
config
,
'r'
)
as
rb
:
_config
=
yaml
.
load
(
rb
.
read
(),
Loader
=
yaml
.
FullLoader
)
else
:
raise
ValueError
(
"reader config only support yaml"
)
envs
.
set_global_envs
(
_config
)
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
init
(
self
):
def
init
(
self
):
pass
pass
...
...
fleetrec/reader/reader_instance.py
浏览文件 @
7f99ff03
...
@@ -16,8 +16,8 @@ import sys
...
@@ -16,8 +16,8 @@ import sys
from
fleetrec.utils.envs
import
lazy_instance
from
fleetrec.utils.envs
import
lazy_instance
if
len
(
sys
.
argv
)
!=
3
:
if
len
(
sys
.
argv
)
!=
4
:
raise
ValueError
(
"reader only accept
two argument: initialized reader class name and TRAIN/EVALUATE
"
)
raise
ValueError
(
"reader only accept
3 argument: 1. reader_class 2.train/evaluate 3.yaml_abs_path
"
)
reader_package
=
sys
.
argv
[
1
]
reader_package
=
sys
.
argv
[
1
]
...
@@ -26,6 +26,8 @@ if sys.argv[2] == "TRAIN":
...
@@ -26,6 +26,8 @@ if sys.argv[2] == "TRAIN":
else
:
else
:
reader_name
=
"EvaluateReader"
reader_name
=
"EvaluateReader"
yaml_abs_path
=
sys
.
argv
[
3
]
reader_class
=
lazy_instance
(
reader_package
,
reader_name
)
reader_class
=
lazy_instance
(
reader_package
,
reader_name
)
reader
=
reader_class
()
reader
=
reader_class
(
yaml_abs_path
)
reader
.
init
()
reader
.
run_from_stdin
()
reader
.
run_from_stdin
()
fleetrec/trainer/factory.py
浏览文件 @
7f99ff03
...
@@ -35,9 +35,9 @@ class TrainerFactory(object):
...
@@ -35,9 +35,9 @@ class TrainerFactory(object):
train_mode
=
envs
.
get_global_env
(
"train.trainer"
)
train_mode
=
envs
.
get_global_env
(
"train.trainer"
)
if
train_mode
==
"SingleTraining"
:
if
train_mode
==
"SingleTraining"
:
trainer
=
SingleTrainer
()
trainer
=
SingleTrainer
(
config
)
elif
train_mode
==
"ClusterTraining"
:
elif
train_mode
==
"ClusterTraining"
:
trainer
=
ClusterTrainer
()
trainer
=
ClusterTrainer
(
config
)
elif
train_mode
==
"CtrTrainer"
:
elif
train_mode
==
"CtrTrainer"
:
trainer
=
CtrPaddleTrainer
(
config
)
trainer
=
CtrPaddleTrainer
(
config
)
else
:
else
:
...
...
fleetrec/trainer/trainer.py
浏览文件 @
7f99ff03
...
@@ -28,6 +28,7 @@ class Trainer(object):
...
@@ -28,6 +28,7 @@ class Trainer(object):
self
.
_exe
=
fluid
.
Executor
(
self
.
_place
)
self
.
_exe
=
fluid
.
Executor
(
self
.
_place
)
self
.
_exector_context
=
{}
self
.
_exector_context
=
{}
self
.
_context
=
{
'status'
:
'uninit'
,
'is_exit'
:
False
}
self
.
_context
=
{
'status'
:
'uninit'
,
'is_exit'
:
False
}
self
.
_config
=
config
def
regist_context_processor
(
self
,
status_name
,
processor
):
def
regist_context_processor
(
self
,
status_name
,
processor
):
"""
"""
...
...
fleetrec/trainer/transpiler_trainer.py
浏览文件 @
7f99ff03
...
@@ -44,7 +44,7 @@ class TranspileTrainer(Trainer):
...
@@ -44,7 +44,7 @@ class TranspileTrainer(Trainer):
reader_class
=
envs
.
get_global_env
(
"class"
,
None
,
namespace
)
reader_class
=
envs
.
get_global_env
(
"class"
,
None
,
namespace
)
abs_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
abs_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
reader
=
os
.
path
.
join
(
abs_dir
,
'..'
,
'reader_implement.py'
)
reader
=
os
.
path
.
join
(
abs_dir
,
'..'
,
'reader_implement.py'
)
pipe_cmd
=
"python {} {} {}
"
.
format
(
reader
,
reader_class
,
"TRAIN"
)
pipe_cmd
=
"python {} {} {}
{}"
.
format
(
reader
,
reader_class
,
"TRAIN"
,
self
.
_config
)
train_data_path
=
envs
.
get_global_env
(
"train_data_path"
,
None
,
namespace
)
train_data_path
=
envs
.
get_global_env
(
"train_data_path"
,
None
,
namespace
)
dataset
=
fluid
.
DatasetFactory
().
create_dataset
()
dataset
=
fluid
.
DatasetFactory
().
create_dataset
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录