Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
431fb9d6
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看板
未验证
提交
431fb9d6
编写于
10月 17, 2019
作者:
H
hutuxian
提交者:
GitHub
10月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some path/download problems (#3643)
上级
541444b1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
56 addition
and
9 deletion
+56
-9
PaddleRec/din/README.md
PaddleRec/din/README.md
+3
-0
PaddleRec/din/train.py
PaddleRec/din/train.py
+2
-2
PaddleRec/gnn/README.md
PaddleRec/gnn/README.md
+2
-1
PaddleRec/gnn/data/download.py
PaddleRec/gnn/data/download.py
+47
-0
PaddleRec/gnn/data/download.sh
PaddleRec/gnn/data/download.sh
+0
-4
PaddleRec/gnn/infer.py
PaddleRec/gnn/infer.py
+1
-1
PaddleRec/gnn/train.py
PaddleRec/gnn/train.py
+1
-1
未找到文件。
PaddleRec/din/README.md
浏览文件 @
431fb9d6
...
...
@@ -41,6 +41,9 @@ cd data && sh data_process.sh && cd ..
pip install pandas
```
**Windows系统下请用户自行下载数据进行解压,下载链接为:[reviews_Electronics](http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/reviews_Electronics_5.json.gz)和[meta_Electronics](http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/meta_Electronics.json.gz)。**
*
Step 2: 产生训练集、测试集和config文件
```
python build_dataset.py
...
...
PaddleRec/din/train.py
浏览文件 @
431fb9d6
...
...
@@ -136,8 +136,8 @@ def train():
if
(
global_step
>
400000
and
global_step
%
PRINT_STEP
==
0
)
or
(
global_step
<=
400000
and
global_step
%
50000
==
0
):
save_dir
=
args
.
model_dir
+
"/global_step_"
+
str
(
global_step
)
save_dir
=
os
.
path
.
join
(
args
.
model_dir
,
"/global_step_"
+
str
(
global_step
)
)
feed_var_name
=
[
"hist_item_seq"
,
"hist_cat_seq"
,
"target_item"
,
"target_cat"
,
"label"
,
"mask"
,
"target_item_seq"
,
...
...
PaddleRec/gnn/README.md
浏览文件 @
431fb9d6
...
...
@@ -40,11 +40,12 @@ SR-GNN模型的介绍可以参阅论文[Session-based Recommendation with Graph
*
Step 1: 运行如下命令,下载DIGINETICA数据集并进行预处理
```
cd data &&
sh download.sh
cd data &&
python download.py
```
*
Step 2: 产生训练集、测试集和config文件
```
mkdir diginetica
python preprocess.py --dataset diginetica
cd ..
```
...
...
PaddleRec/gnn/data/download.py
0 → 100644
浏览文件 @
431fb9d6
import
requests
import
sys
import
time
import
os
lasttime
=
time
.
time
()
FLUSH_INTERVAL
=
0.1
def
progress
(
str
,
end
=
False
):
global
lasttime
if
end
:
str
+=
"
\n
"
lasttime
=
0
if
time
.
time
()
-
lasttime
>=
FLUSH_INTERVAL
:
sys
.
stdout
.
write
(
"
\r
%s"
%
str
)
lasttime
=
time
.
time
()
sys
.
stdout
.
flush
()
def
_download_file
(
url
,
savepath
,
print_progress
):
r
=
requests
.
get
(
url
,
stream
=
True
)
total_length
=
r
.
headers
.
get
(
'content-length'
)
if
total_length
is
None
:
with
open
(
savepath
,
'wb'
)
as
f
:
shutil
.
copyfileobj
(
r
.
raw
,
f
)
else
:
with
open
(
savepath
,
'wb'
)
as
f
:
dl
=
0
total_length
=
int
(
total_length
)
starttime
=
time
.
time
()
if
print_progress
:
print
(
"Downloading %s"
%
os
.
path
.
basename
(
savepath
))
for
data
in
r
.
iter_content
(
chunk_size
=
4096
):
dl
+=
len
(
data
)
f
.
write
(
data
)
if
print_progress
:
done
=
int
(
50
*
dl
/
total_length
)
progress
(
"[%-50s] %.2f%%"
%
(
'='
*
done
,
float
(
100
*
dl
)
/
total_length
))
if
print_progress
:
progress
(
"[%-50s] %.2f%%"
%
(
'='
*
50
,
100
),
end
=
True
)
_download_file
(
"https://sr-gnn.bj.bcebos.com/train-item-views.csv"
,
"./train-item-views.csv"
,
True
)
PaddleRec/gnn/data/download.sh
已删除
100644 → 0
浏览文件 @
541444b1
#!/bin/bash
wget
--no-check-certificate
https://sr-gnn.bj.bcebos.com/train-item-views.csv
mkdir
diginetica
PaddleRec/gnn/infer.py
浏览文件 @
431fb9d6
...
...
@@ -60,7 +60,7 @@ def infer(args):
infer_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
for
epoch_num
in
range
(
args
.
start_index
,
args
.
last_index
+
1
):
model_path
=
args
.
model_path
+
"epoch_"
+
str
(
epoch_num
)
model_path
=
os
.
path
.
join
(
args
.
model_path
,
"epoch_"
+
str
(
epoch_num
)
)
try
:
if
not
os
.
path
.
exists
(
model_path
):
raise
ValueError
()
...
...
PaddleRec/gnn/train.py
浏览文件 @
431fb9d6
...
...
@@ -139,7 +139,7 @@ def train():
except
fluid
.
core
.
EOFException
:
py_reader
.
reset
()
logger
.
info
(
"epoch loss: %.4lf"
%
(
np
.
mean
(
epoch_sum
)))
save_dir
=
args
.
model_path
+
"/epoch_"
+
str
(
i
)
save_dir
=
os
.
path
.
join
(
args
.
model_path
,
"epoch_"
+
str
(
i
)
)
fetch_vars
=
[
loss
,
acc
]
fluid
.
io
.
save_inference_model
(
save_dir
,
feed_list
,
fetch_vars
,
exe
)
logger
.
info
(
"model saved in "
+
save_dir
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录