Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
cccc61c0
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看板
提交
cccc61c0
编写于
4月 02, 2020
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ctr-dnn local training
上级
afec7a49
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
109 addition
and
108 deletion
+109
-108
examples/ctr-dnn_train.yaml
examples/ctr-dnn_train.yaml
+2
-5
models/ctr_dnn/data/train/sample_train.txt
models/ctr_dnn/data/train/sample_train.txt
+100
-100
models/ctr_dnn/dataset.py
models/ctr_dnn/dataset.py
+4
-0
models/ctr_dnn/model.py
models/ctr_dnn/model.py
+2
-2
trainer/single_train.py
trainer/single_train.py
+1
-1
未找到文件。
examples/ctr-dnn_train.yaml
浏览文件 @
cccc61c0
...
@@ -34,7 +34,7 @@ train:
...
@@ -34,7 +34,7 @@ train:
reader
:
reader
:
mode
:
"
dataset"
mode
:
"
dataset"
batch_size
:
32
batch_size
:
2
pipe_command
:
"
python
/paddle/eleps/models/ctr_dnn/dataset.py"
pipe_command
:
"
python
/paddle/eleps/models/ctr_dnn/dataset.py"
train_data_path
:
"
/paddle/eleps/models/ctr_dnn/data/train"
train_data_path
:
"
/paddle/eleps/models/ctr_dnn/data/train"
...
@@ -45,10 +45,7 @@ train:
...
@@ -45,10 +45,7 @@ train:
sparse_feature_number
:
1000001
sparse_feature_number
:
1000001
sparse_feature_dim
:
8
sparse_feature_dim
:
8
dense_input_dim
:
13
dense_input_dim
:
13
fc_sizes
:
[
101
,
512
,
32
]
fc_sizes
:
[
512
,
256
,
128
,
32
]
# - 1024
# - 512
# - 32
learning_rate
:
0.001
learning_rate
:
0.001
save
:
save
:
...
...
models/ctr_dnn/data/train/sample_train.txt
浏览文件 @
cccc61c0
此差异已折叠。
点击以展开。
models/ctr_dnn/dataset.py
浏览文件 @
cccc61c0
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
from
__future__
import
print_function
import
sys
import
paddle.fluid.incubate.data_generator
as
dg
import
paddle.fluid.incubate.data_generator
as
dg
...
@@ -37,6 +39,7 @@ class CriteoDataset(dg.MultiSlotDataGenerator):
...
@@ -37,6 +39,7 @@ class CriteoDataset(dg.MultiSlotDataGenerator):
This function needs to be implemented by the user, based on data format
This function needs to be implemented by the user, based on data format
"""
"""
features
=
line
.
rstrip
(
'
\n
'
).
split
(
'
\t
'
)
features
=
line
.
rstrip
(
'
\n
'
).
split
(
'
\t
'
)
dense_feature
=
[]
dense_feature
=
[]
sparse_feature
=
[]
sparse_feature
=
[]
for
idx
in
continuous_range_
:
for
idx
in
continuous_range_
:
...
@@ -46,6 +49,7 @@ class CriteoDataset(dg.MultiSlotDataGenerator):
...
@@ -46,6 +49,7 @@ class CriteoDataset(dg.MultiSlotDataGenerator):
dense_feature
.
append
(
dense_feature
.
append
(
(
float
(
features
[
idx
])
-
cont_min_
[
idx
-
1
])
/
(
float
(
features
[
idx
])
-
cont_min_
[
idx
-
1
])
/
cont_diff_
[
idx
-
1
])
cont_diff_
[
idx
-
1
])
for
idx
in
categorical_range_
:
for
idx
in
categorical_range_
:
sparse_feature
.
append
(
sparse_feature
.
append
(
[
hash
(
str
(
idx
)
+
features
[
idx
])
%
hash_dim_
])
[
hash
(
str
(
idx
)
+
features
[
idx
])
%
hash_dim_
])
...
...
models/ctr_dnn/model.py
浏览文件 @
cccc61c0
...
@@ -39,7 +39,7 @@ class Train(object):
...
@@ -39,7 +39,7 @@ class Train(object):
fluid
.
layers
.
data
(
name
=
"C"
+
str
(
i
),
fluid
.
layers
.
data
(
name
=
"C"
+
str
(
i
),
shape
=
[
1
],
shape
=
[
1
],
lod_level
=
1
,
lod_level
=
1
,
dtype
=
"int64"
)
for
i
in
range
(
ids
)
dtype
=
"int64"
)
for
i
in
range
(
1
,
ids
)
]
]
return
sparse_input_ids
,
[
var
.
name
for
var
in
sparse_input_ids
]
return
sparse_input_ids
,
[
var
.
name
for
var
in
sparse_input_ids
]
...
@@ -60,7 +60,7 @@ class Train(object):
...
@@ -60,7 +60,7 @@ class Train(object):
self
.
label_input
,
self
.
label_input_varname
=
label_input
()
self
.
label_input
,
self
.
label_input_varname
=
label_input
()
def
input_vars
(
self
):
def
input_vars
(
self
):
return
self
.
sparse_inputs
+
[
self
.
dense_input
]
+
[
self
.
label_input
]
return
[
self
.
dense_input
]
+
self
.
sparse_inputs
+
[
self
.
label_input
]
def
input_varnames
(
self
):
def
input_varnames
(
self
):
return
[
input
.
name
for
input
in
self
.
input_vars
()]
return
[
input
.
name
for
input
in
self
.
input_vars
()]
...
...
trainer/single_train.py
浏览文件 @
cccc61c0
...
@@ -169,7 +169,7 @@ class SingleTrainerWithDataset(SingleTrainer):
...
@@ -169,7 +169,7 @@ class SingleTrainerWithDataset(SingleTrainer):
dataset
=
dataset
,
dataset
=
dataset
,
fetch_list
=
self
.
metrics
,
fetch_list
=
self
.
metrics
,
fetch_info
=
[
"auc "
,
"batch auc"
],
fetch_info
=
[
"auc "
,
"batch auc"
],
print_period
=
1
00
)
print_period
=
1
)
context
[
'status'
]
=
'infer_pass'
context
[
'status'
]
=
'infer_pass'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录