Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
2a167ec9
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看板
未验证
提交
2a167ec9
编写于
10月 12, 2019
作者:
H
hutuxian
提交者:
GitHub
10月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add check version (#3530)
Add version checking for DIN and SR-GNN.
上级
e743c29c
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
82 addition
and
1 deletion
+82
-1
PaddleRec/din/README.md
PaddleRec/din/README.md
+1
-0
PaddleRec/din/cluster_train.py
PaddleRec/din/cluster_train.py
+17
-1
PaddleRec/din/infer.py
PaddleRec/din/infer.py
+16
-0
PaddleRec/din/train.py
PaddleRec/din/train.py
+15
-0
PaddleRec/gnn/README.md
PaddleRec/gnn/README.md
+1
-0
PaddleRec/gnn/infer.py
PaddleRec/gnn/infer.py
+17
-0
PaddleRec/gnn/train.py
PaddleRec/gnn/train.py
+15
-0
未找到文件。
PaddleRec/din/README.md
浏览文件 @
2a167ec9
...
...
@@ -29,6 +29,7 @@ DIN通过一个兴趣激活模块(Activation Unit),用预估目标Candidate AD
最后我们将这相关的用户兴趣表达、用户静态特征和上下文相关特征,以及ad相关的特征拼接起来,输入到后续的多层DNN网络,最后预测得到用户对当前目标ADs的点击概率。
**目前模型库下模型均要求使用PaddlePaddle 1.6及以上版本或适当的develop版本。**
## 数据下载及预处理
...
...
PaddleRec/din/cluster_train.py
浏览文件 @
2a167ec9
...
...
@@ -9,6 +9,7 @@ import time
import
network
import
reader
import
random
import
sys
logging
.
basicConfig
(
format
=
'%(asctime)s - %(levelname)s - %(message)s'
)
logger
=
logging
.
getLogger
(
"fluid"
)
...
...
@@ -85,7 +86,7 @@ def train():
#data_reader, max_len = reader.prepare_reader(train_path, args.batch_size)
logger
.
info
(
"reading data completes"
)
avg_cost
,
pred
=
network
.
network
(
item_count
,
cat_count
,
433
)
avg_cost
,
pred
=
network
.
network
(
item_count
,
cat_count
)
#fluid.clip.set_gradient_clip(clip=fluid.clip.GradientClipByGlobalNorm(clip_norm=5.0))
base_lr
=
args
.
base_lr
boundaries
=
[
410000
]
...
...
@@ -167,6 +168,21 @@ def train():
logger
.
info
(
"run trainer"
)
train_loop
(
t
.
get_trainer_program
())
def
check_version
():
"""
Log error and exit when the installed version of paddlepaddle is
not satisfied.
"""
err
=
"PaddlePaddle version 1.6 or higher is required, "
\
"or a suitable develop version is satisfied as well.
\n
"
\
"Please make sure the version is good with your code."
\
try
:
fluid
.
require_version
(
'1.6.0'
)
except
Exception
as
e
:
logger
.
error
(
err
)
sys
.
exit
(
1
)
if
__name__
==
"__main__"
:
check_version
()
train
()
PaddleRec/din/infer.py
浏览文件 @
2a167ec9
...
...
@@ -19,6 +19,7 @@ import os
import
paddle
import
paddle.fluid
as
fluid
import
reader
import
sys
logging
.
basicConfig
(
format
=
'%(asctime)s - %(levelname)s - %(message)s'
)
logger
=
logging
.
getLogger
(
"fluid"
)
...
...
@@ -99,6 +100,21 @@ def infer():
auc
=
calc_auc
(
score
)
logger
.
info
(
"TEST --> loss: {}, auc: {}"
.
format
(
loss_sum
/
count
,
auc
))
def
check_version
():
"""
Log error and exit when the installed version of paddlepaddle is
not satisfied.
"""
err
=
"PaddlePaddle version 1.6 or higher is required, "
\
"or a suitable develop version is satisfied as well.
\n
"
\
"Please make sure the version is good with your code."
\
try
:
fluid
.
require_version
(
'1.6.0'
)
except
Exception
as
e
:
logger
.
error
(
err
)
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
check_version
()
infer
()
PaddleRec/din/train.py
浏览文件 @
2a167ec9
...
...
@@ -173,6 +173,21 @@ def get_cards(args):
else
:
return
args
.
num_devices
def
check_version
():
"""
Log error and exit when the installed version of paddlepaddle is
not satisfied.
"""
err
=
"PaddlePaddle version 1.6 or higher is required, "
\
"or a suitable develop version is satisfied as well.
\n
"
\
"Please make sure the version is good with your code."
\
try
:
fluid
.
require_version
(
'1.6.0'
)
except
Exception
as
e
:
logger
.
error
(
err
)
sys
.
exit
(
1
)
if
__name__
==
"__main__"
:
check_version
()
train
()
PaddleRec/gnn/README.md
浏览文件 @
2a167ec9
...
...
@@ -31,6 +31,7 @@ SR-GNN模型的介绍可以参阅论文[Session-based Recommendation with Graph
我们复现了论文效果,在DIGINETICA数据集上P@20可以达到50.7
**目前模型库下模型均要求使用PaddlePaddle 1.6及以上版本或适当的develop版本。**
## 数据下载及预处理
...
...
PaddleRec/gnn/infer.py
浏览文件 @
2a167ec9
...
...
@@ -20,6 +20,7 @@ import paddle
import
paddle.fluid
as
fluid
import
reader
import
network
import
sys
logging
.
basicConfig
(
format
=
'%(asctime)s - %(levelname)s - %(message)s'
)
logger
=
logging
.
getLogger
(
"fluid"
)
...
...
@@ -87,6 +88,22 @@ def infer(args):
logger
.
info
(
"TEST --> error: there is no model in "
+
model_path
)
def
check_version
():
"""
Log error and exit when the installed version of paddlepaddle is
not satisfied.
"""
err
=
"PaddlePaddle version 1.6 or higher is required, "
\
"or a suitable develop version is satisfied as well.
\n
"
\
"Please make sure the version is good with your code."
\
try
:
fluid
.
require_version
(
'1.6.0'
)
except
Exception
as
e
:
logger
.
error
(
err
)
sys
.
exit
(
1
)
if
__name__
==
"__main__"
:
check_version
()
args
=
parse_args
()
infer
(
args
)
PaddleRec/gnn/train.py
浏览文件 @
2a167ec9
...
...
@@ -170,6 +170,21 @@ def get_cards(args):
num
=
len
(
cards
.
split
(
","
))
return
num
def
check_version
():
"""
Log error and exit when the installed version of paddlepaddle is
not satisfied.
"""
err
=
"PaddlePaddle version 1.6 or higher is required, "
\
"or a suitable develop version is satisfied as well.
\n
"
\
"Please make sure the version is good with your code."
\
try
:
fluid
.
require_version
(
'1.6.0'
)
except
Exception
as
e
:
logger
.
error
(
err
)
sys
.
exit
(
1
)
if
__name__
==
"__main__"
:
check_version
()
train
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录