Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
83424e13
M
models
项目概览
PaddlePaddle
/
models
接近 2 年 前同步成功
通知
230
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看板
提交
83424e13
编写于
10月 24, 2018
作者:
F
frankwhzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix README, change train.py input format
上级
ce19c955
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
7 deletion
+13
-7
fluid/recommendation/gru4rec/README.md
fluid/recommendation/gru4rec/README.md
+7
-4
fluid/recommendation/gru4rec/train.py
fluid/recommendation/gru4rec/train.py
+6
-3
未找到文件。
fluid/recommendation/gru4rec/README.md
浏览文件 @
83424e13
...
...
@@ -74,15 +74,18 @@ python convert_format.py
```
## 训练
GPU 环境 默认配置
运行命令
`CUDA_VISIBLE_DEVICES=0 python train.py train_file test_file`
开始训练模型。
--use_cuda 1 表示使用gpu --parallel 1 表示多卡 0 表示单卡
GPU 环境
运行命令
`CUDA_VISIBLE_DEVICES=0 python train.py train_file test_file `
开始训练模型。
```
python
CUDA_VISIBLE_DEVICES
=
0
python
train
.
py
small_train
.
txt
small_test
.
file
CUDA_VISIBLE_DEVICES
=
0
python
train
.
py
small_train
.
txt
small_test
.
txt
--
use_cuda
1
--
parallel
0
```
CPU 环境
运行命令
`python train.py train_file test_file`
开始训练模型。
```
python
python
train
.
py
small_train
.
txt
small_test
.
txt
python
train
.
py
small_train
.
txt
small_test
.
txt
--
use_cuda
0
--
parallel
0
```
当前支持的参数可参见
[
train.py
](
./train.py
)
`train_net`
函数
...
...
fluid/recommendation/gru4rec/train.py
浏览文件 @
83424e13
...
...
@@ -17,7 +17,8 @@ def parse_args():
parser
=
argparse
.
ArgumentParser
(
"gru4rec benchmark."
)
parser
.
add_argument
(
'train_file'
)
parser
.
add_argument
(
'test_file'
)
parser
.
add_argument
(
'--use_cuda'
,
help
=
'whether use gpu'
)
parser
.
add_argument
(
'--parallel'
,
help
=
'whether parallel'
)
parser
.
add_argument
(
'--enable_ce'
,
action
=
'store_true'
,
...
...
@@ -182,6 +183,8 @@ def train_net():
args
=
parse_args
()
train_file
=
args
.
train_file
test_file
=
args
.
test_file
use_cuda
=
True
if
args
.
use_cuda
else
False
parallel
=
True
if
args
.
parallel
else
False
batch_size
=
50
vocab
,
train_reader
,
test_reader
=
utils
.
prepare_data
(
train_file
,
test_file
,
batch_size
=
batch_size
*
get_cards
(
args
),
\
...
...
@@ -194,8 +197,8 @@ def train_net():
base_lr
=
0.01
,
batch_size
=
batch_size
,
pass_num
=
10
,
use_cuda
=
True
,
parallel
=
False
,
use_cuda
=
use_cuda
,
parallel
=
parallel
,
model_dir
=
"model_recall20"
,
init_low_bound
=-
0.1
,
init_high_bound
=
0.1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录