Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
00b2de4b
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看板
提交
00b2de4b
编写于
5月 29, 2020
作者:
F
frankwhzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix listwise
上级
018a2916
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
56 deletion
+59
-56
models/rerank/listwise/config.yaml
models/rerank/listwise/config.yaml
+48
-36
models/rerank/listwise/model.py
models/rerank/listwise/model.py
+7
-12
models/rerank/listwise/random_reader.py
models/rerank/listwise/random_reader.py
+4
-8
未找到文件。
models/rerank/listwise/config.yaml
浏览文件 @
00b2de4b
...
@@ -12,44 +12,56 @@
...
@@ -12,44 +12,56 @@
# 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.
evaluate
:
reader
:
batch_size
:
1
class
:
"
{workspace}/random_infer_reader.py"
test_data_path
:
"
{workspace}/data/train"
train
:
workspace
:
"
paddlerec.models.rerank.listwise"
trainer
:
# for cluster training
strategy
:
"
async"
epochs
:
3
dataset
:
workspace
:
"
paddlerec.models.rerank.listwise"
-
name
:
dataset_train
device
:
cpu
type
:
DataLoader
data_path
:
"
{workspace}/data/train"
data_converter
:
"
{workspace}/random_reader.py"
-
name
:
dataset_infer
type
:
DataLoader
data_path
:
"
{workspace}/data/test"
data_converter
:
"
{workspace}/random_reader.py"
reader
:
hyper_parameters
:
batch_size
:
2
hidden_size
:
128
class
:
"
{workspace}/random_reader.py"
user_vocab
:
200
train_data_path
:
"
{workspace}/data/train"
item_vocab
:
1000
dataset_class
:
"
DataLoader"
item_len
:
5
embed_size
:
16
batch_size
:
1
optimizer
:
class
:
sgd
learning_rate
:
0.01
strategy
:
async
model
:
#use infer_runner mode and modify 'phase' below if infer
models
:
"
{workspace}/model.py"
mode
:
train_runner
hyper_parameters
:
#mode: infer_runner
hidden_size
:
128
user_vocab
:
200
runner
:
item_vocab
:
1000
-
name
:
train_runner
item_len
:
5
class
:
single_train
embed_size
:
16
device
:
cpu
learning_rate
:
0.01
epochs
:
3
optimizer
:
sgd
save_checkpoint_interval
:
2
save_inference_interval
:
4
save_checkpoint_path
:
"
increment"
save_inference_path
:
"
inference"
-
name
:
infer_runner
class
:
single_infer
init_model_path
:
"
increment/0"
device
:
cpu
epochs
:
3
sav
e
:
phas
e
:
increment
:
-
name
:
train
dirname
:
"
increment
"
model
:
"
{workspace}/model.py
"
epoch_interval
:
2
dataset_name
:
dataset_train
save_last
:
True
thread_num
:
1
inference
:
#- name: infer
dirname
:
"
inference
"
# model: "{workspace}/model.py
"
epoch_interval
:
4
# dataset_name: dataset_infer
save_last
:
True
# thread_num: 1
models/rerank/listwise/model.py
浏览文件 @
00b2de4b
...
@@ -25,18 +25,13 @@ class Model(ModelBase):
...
@@ -25,18 +25,13 @@ class Model(ModelBase):
ModelBase
.
__init__
(
self
,
config
)
ModelBase
.
__init__
(
self
,
config
)
def
_init_hyper_parameters
(
self
):
def
_init_hyper_parameters
(
self
):
self
.
item_len
=
envs
.
get_global_env
(
"hyper_parameters.self.item_len"
,
self
.
item_len
=
envs
.
get_global_env
(
"hyper_parameters.self.item_len"
)
None
,
self
.
_namespace
)
self
.
hidden_size
=
envs
.
get_global_env
(
"hyper_parameters.hidden_size"
)
self
.
hidden_size
=
envs
.
get_global_env
(
"hyper_parameters.hidden_size"
,
self
.
user_vocab
=
envs
.
get_global_env
(
"hyper_parameters.user_vocab"
)
None
,
self
.
_namespace
)
self
.
item_vocab
=
envs
.
get_global_env
(
"hyper_parameters.item_vocab"
)
self
.
user_vocab
=
envs
.
get_global_env
(
"hyper_parameters.user_vocab"
,
self
.
embed_size
=
envs
.
get_global_env
(
"hyper_parameters.embed_size"
)
None
,
self
.
_namespace
)
self
.
item_vocab
=
envs
.
get_global_env
(
"hyper_parameters.item_vocab"
,
def
input_data
(
self
,
is_infer
=
False
,
**
kwargs
):
None
,
self
.
_namespace
)
self
.
embed_size
=
envs
.
get_global_env
(
"hyper_parameters.embed_size"
,
None
,
self
.
_namespace
)
def
input_data
(
self
,
is_infer
=
False
):
user_slot_names
=
fluid
.
data
(
user_slot_names
=
fluid
.
data
(
name
=
'user_slot_names'
,
name
=
'user_slot_names'
,
shape
=
[
None
,
1
],
shape
=
[
None
,
1
],
...
...
models/rerank/listwise/random_reader.py
浏览文件 @
00b2de4b
...
@@ -23,14 +23,10 @@ from collections import defaultdict
...
@@ -23,14 +23,10 @@ from collections import defaultdict
class
TrainReader
(
Reader
):
class
TrainReader
(
Reader
):
def
init
(
self
):
def
init
(
self
):
self
.
user_vocab
=
envs
.
get_global_env
(
"hyper_parameters.user_vocab"
,
self
.
user_vocab
=
envs
.
get_global_env
(
"hyper_parameters.user_vocab"
)
None
,
"train.model"
)
self
.
item_vocab
=
envs
.
get_global_env
(
"hyper_parameters.item_vocab"
)
self
.
item_vocab
=
envs
.
get_global_env
(
"hyper_parameters.item_vocab"
,
self
.
item_len
=
envs
.
get_global_env
(
"hyper_parameters.item_len"
)
None
,
"train.model"
)
self
.
batch_size
=
envs
.
get_global_env
(
"hyper_parameters.batch_size"
)
self
.
item_len
=
envs
.
get_global_env
(
"hyper_parameters.item_len"
,
None
,
"train.model"
)
self
.
batch_size
=
envs
.
get_global_env
(
"batch_size"
,
None
,
"train.reader"
)
def
reader_creator
(
self
):
def
reader_creator
(
self
):
def
reader
():
def
reader
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录