Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
6c14f65e
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6c14f65e
编写于
2月 14, 2020
作者:
Z
zhang wenhui
提交者:
GitHub
2月 14, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update1.7 save/load & fluid.data (#4283)
上级
768938c1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
13 addition
and
28 deletion
+13
-28
PaddleRec/gru4rec/infer_sample_neg.py
PaddleRec/gru4rec/infer_sample_neg.py
+1
-2
PaddleRec/gru4rec/train_sample_neg.py
PaddleRec/gru4rec/train_sample_neg.py
+1
-1
PaddleRec/multi-task/MMoE/mmoe_train.py
PaddleRec/multi-task/MMoE/mmoe_train.py
+8
-21
PaddleRec/ssr/cluster_train.py
PaddleRec/ssr/cluster_train.py
+1
-1
PaddleRec/ssr/infer.py
PaddleRec/ssr/infer.py
+1
-2
PaddleRec/ssr/train.py
PaddleRec/ssr/train.py
+1
-1
未找到文件。
PaddleRec/gru4rec/infer_sample_neg.py
浏览文件 @
6c14f65e
...
...
@@ -47,8 +47,7 @@ def infer(args, vocab_size, test_reader, use_cuda):
for
epoch
in
range
(
start_index
,
last_index
+
1
):
copy_program
=
main_program
.
clone
()
model_path
=
model_dir
+
"/epoch_"
+
str
(
epoch
)
fluid
.
io
.
load_params
(
executor
=
exe
,
dirname
=
model_path
,
main_program
=
copy_program
)
fluid
.
load
(
copy_program
,
model_path
,
exe
)
accum_num_recall
=
0.0
accum_num_sum
=
0.0
t0
=
time
.
time
()
...
...
PaddleRec/gru4rec/train_sample_neg.py
浏览文件 @
6c14f65e
...
...
@@ -121,7 +121,7 @@ def train():
print
(
"epoch:%d num_steps:%d time_cost(s):%f"
%
(
epoch_idx
,
i
,
total_time
/
epoch_idx
))
save_dir
=
"%s/epoch_%d"
%
(
model_dir
,
epoch_idx
)
fluid
.
io
.
save_params
(
executor
=
exe
,
dirname
=
save_dir
)
fluid
.
save
(
fluid
.
default_main_program
(),
model_path
=
save_dir
)
print
(
"model saved in %s"
%
save_dir
)
print
(
"finish training"
)
...
...
PaddleRec/multi-task/MMoE/mmoe_train.py
浏览文件 @
6c14f65e
...
...
@@ -59,27 +59,14 @@ def mmoe_layer(inputs, expert_num=8, gate_num=3):
def
model
(
dict_dim
,
emb_dim
):
label_like
=
fluid
.
layers
.
data
(
name
=
"label_like"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
lod_level
=
0
,
append_batch_size
=
False
)
label_comment
=
fluid
.
layers
.
data
(
name
=
"label_comment"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
lod_level
=
0
,
append_batch_size
=
False
)
label_share
=
fluid
.
layers
.
data
(
name
=
"label_share"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
lod_level
=
0
,
append_batch_size
=
False
)
a_data
=
fluid
.
layers
.
data
(
name
=
"a"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
append_batch_size
=
False
)
label_like
=
fluid
.
data
(
name
=
"label_like"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
lod_level
=
0
)
label_comment
=
fluid
.
data
(
name
=
"label_comment"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
lod_level
=
0
)
label_share
=
fluid
.
data
(
name
=
"label_share"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
,
lod_level
=
0
)
a_data
=
fluid
.
data
(
name
=
"a"
,
shape
=
[
-
1
,
1
],
dtype
=
"int64"
)
emb
=
fluid
.
layers
.
embedding
(
input
=
a_data
,
size
=
[
dict_dim
,
emb_dim
])
outs
=
mmoe_layer
(
emb
,
expert_num
=
8
,
gate_num
=
3
)
...
...
PaddleRec/ssr/cluster_train.py
浏览文件 @
6c14f65e
...
...
@@ -121,7 +121,7 @@ def train_loop(main_program, avg_cost, acc, train_input_data, place, args,
print
(
"epoch:%d num_steps:%d time_cost(s):%f"
%
(
epoch_idx
,
i
,
total_time
/
epoch_idx
))
save_dir
=
"%s/epoch_%d"
%
(
args
.
model_dir
,
epoch_idx
)
fluid
.
io
.
save_params
(
executor
=
exe
,
dirname
=
save_dir
)
fluid
.
save
(
fluid
.
default_main_program
(),
save_dir
)
print
(
"model saved in %s"
%
save_dir
)
# only for ce
...
...
PaddleRec/ssr/infer.py
浏览文件 @
6c14f65e
...
...
@@ -84,8 +84,7 @@ def infer(args, vocab_size, test_reader):
for
epoch
in
range
(
start_index
,
last_index
+
1
):
copy_program
=
main_program
.
clone
()
model_path
=
model_dir
+
"/epoch_"
+
str
(
epoch
)
fluid
.
io
.
load_params
(
executor
=
exe
,
dirname
=
model_path
,
main_program
=
copy_program
)
fluid
.
load
(
copy_program
,
model_path
,
exe
)
accum_num_recall
=
0.0
accum_num_sum
=
0.0
t0
=
time
.
time
()
...
...
PaddleRec/ssr/train.py
浏览文件 @
6c14f65e
...
...
@@ -121,7 +121,7 @@ def train(args):
print
(
"epoch:%d num_steps:%d time_cost(s):%f"
%
(
epoch_idx
,
i
,
total_time
/
epoch_idx
))
save_dir
=
"%s/epoch_%d"
%
(
args
.
model_dir
,
epoch_idx
)
fluid
.
io
.
save_params
(
executor
=
exe
,
dirname
=
save_dir
)
fluid
.
save
(
fluid
.
default_main_program
(),
model_path
=
save_dir
)
print
(
"model saved in %s"
%
save_dir
)
# only for ce
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录