Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
2cba27a6
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看板
提交
2cba27a6
编写于
4月 16, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix import
上级
2e91f58f
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
27 addition
and
40 deletion
+27
-40
fleetrec/core/factory.py
fleetrec/core/factory.py
+1
-4
fleetrec/core/trainers/ctr_coding_trainer.py
fleetrec/core/trainers/ctr_coding_trainer.py
+0
-4
fleetrec/core/utils/envs.py
fleetrec/core/utils/envs.py
+8
-0
fleetrec/examples/__init__.py
fleetrec/examples/__init__.py
+0
-18
fleetrec/examples/build_in/__init__.py
fleetrec/examples/build_in/__init__.py
+0
-0
fleetrec/examples/build_in/cluster_training_mpi.yaml
fleetrec/examples/build_in/cluster_training_mpi.yaml
+0
-10
fleetrec/examples/ctr-dnn_train.yaml
fleetrec/examples/ctr-dnn_train.yaml
+1
-1
fleetrec/examples/user_define/__init__.py
fleetrec/examples/user_define/__init__.py
+0
-0
fleetrec/examples/user_define/user_define_trainer.py
fleetrec/examples/user_define/user_define_trainer.py
+0
-0
fleetrec/examples/user_define/user_define_trainer.yaml
fleetrec/examples/user_define/user_define_trainer.yaml
+0
-0
fleetrec/models/ctr_dnn/model.py
fleetrec/models/ctr_dnn/model.py
+8
-3
fleetrec/run.py
fleetrec/run.py
+9
-0
未找到文件。
fleetrec/core/factory.py
浏览文件 @
2cba27a6
...
...
@@ -28,10 +28,7 @@ class TrainerFactory(object):
def
_build_trainer
(
yaml_path
):
print
(
envs
.
pretty_print_envs
(
envs
.
get_global_envs
()))
train_mode
=
envs
.
get_global_env
(
"train.trainer"
)
if
train_mode
is
None
:
train_mode
=
envs
.
get_runtime_envion
(
"train.trainer"
)
train_mode
=
envs
.
get_training_mode
()
if
train_mode
==
"SingleTraining"
:
from
fleetrec.core.trainers.single_trainer
import
SingleTrainer
...
...
fleetrec/core/trainers/ctr_coding_trainer.py
浏览文件 @
2cba27a6
...
...
@@ -12,10 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
sys
import
time
import
json
import
datetime
import
numpy
as
np
import
paddle.fluid
as
fluid
...
...
fleetrec/core/utils/envs.py
浏览文件 @
2cba27a6
...
...
@@ -29,6 +29,14 @@ def get_runtime_envion(key):
return
os
.
getenv
(
key
,
None
)
def
get_training_mode
():
train_mode
=
get_global_env
(
"train.trainer"
)
if
train_mode
is
None
:
train_mode
=
get_runtime_envion
(
"train.trainer"
)
return
train_mode
def
set_global_envs
(
envs
):
assert
isinstance
(
envs
,
dict
)
...
...
fleetrec/examples/__init__.py
浏览文件 @
2cba27a6
# 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.
"""
examples for user
"""
\ No newline at end of file
fleetrec/examples/build_in/__init__.py
已删除
100644 → 0
浏览文件 @
2e91f58f
fleetrec/examples/build_in/cluster_training_mpi.yaml
已删除
100644 → 0
浏览文件 @
2e91f58f
trainer
:
"
MPIClusterTraining"
pserver_num
:
2
trainer_num
:
2
start_port
:
36001
log_dirname
:
"
logs"
strategy
:
mode
:
"
async"
fleetrec/examples/
build_in/
ctr-dnn_train.yaml
→
fleetrec/examples/ctr-dnn_train.yaml
浏览文件 @
2cba27a6
...
...
@@ -27,7 +27,7 @@ train:
hyper_parameters
:
sparse_inputs_slots
:
27
sparse_feature_number
:
1000001
sparse_feature_dim
:
8
sparse_feature_dim
:
9
dense_input_dim
:
13
fc_sizes
:
[
512
,
256
,
128
,
32
]
learning_rate
:
0.001
...
...
fleetrec/examples/user_define/__init__.py
已删除
100644 → 0
浏览文件 @
2e91f58f
fleetrec/examples/
build_in
/user_define_trainer.py
→
fleetrec/examples/
user_define
/user_define_trainer.py
浏览文件 @
2cba27a6
文件已移动
fleetrec/examples/
build_in/cluster_training_user_define
.yaml
→
fleetrec/examples/
user_define/user_define_trainer
.yaml
浏览文件 @
2cba27a6
文件已移动
fleetrec/models/ctr_dnn/model.py
浏览文件 @
2cba27a6
...
...
@@ -60,13 +60,18 @@ class Model(ModelBase):
self
.
_data_var
.
append
(
self
.
label_input
)
def
net
(
self
):
def
embedding_layer
(
input
):
sparse_feature_number
=
envs
.
get_global_env
(
"hyper_parameters.sparse_feature_number"
,
None
,
self
.
namespace
)
sparse_feature_dim
=
envs
.
get_global_env
(
"hyper_parameters.sparse_feature_dim"
,
None
,
self
.
namespace
)
train_mode
=
envs
.
get_training_mode
()
is_distributed
=
True
if
train_mode
==
"CtrTraining"
else
False
sparse_feature_number
=
envs
.
get_global_env
(
"hyper_parameters.sparse_feature_number"
,
None
,
self
.
namespace
)
sparse_feature_dim
=
envs
.
get_global_env
(
"hyper_parameters.sparse_feature_dim"
,
None
,
self
.
namespace
)
sparse_feature_dim
=
9
if
train_mode
==
"CtrTraining"
else
sparse_feature_dim
def
embedding_layer
(
input
):
emb
=
fluid
.
layers
.
embedding
(
input
=
input
,
is_sparse
=
True
,
is_distributed
=
is_distributed
,
size
=
[
sparse_feature_number
,
sparse_feature_dim
],
param_attr
=
fluid
.
ParamAttr
(
name
=
"SparseFeatFactors"
,
...
...
fleetrec/run.py
浏览文件 @
2cba27a6
...
...
@@ -103,6 +103,15 @@ if __name__ == "__main__":
local_mpi_engine
(
cluster_envs
,
args
.
model
)
elif
args
.
engine
.
upper
()
==
"CLUSTER"
:
print
(
"launch ClusterTraining with cluster to run model: {}"
.
format
(
args
.
model
))
if
version
.
is_transpiler
():
print
(
"use ClusterTraining to run model: {}"
.
format
(
args
.
model
))
cluster_envs
=
{
"train.trainer"
:
"ClusterTraining"
}
envs
.
set_runtime_envions
(
cluster_envs
)
else
:
cluster_envs
=
{
"train.trainer"
:
"CtrTraining"
}
envs
.
set_runtime_envions
(
cluster_envs
)
run
(
args
.
model
)
elif
args
.
engine
.
upper
()
==
"USER_DEFINE"
:
engine_file
=
args
.
engine_extras
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录