From 02770a3d62c8c3acdebb50f54f8c41f4829d8c42 Mon Sep 17 00:00:00 2001 From: frankwhzhang Date: Wed, 24 Oct 2018 13:26:35 +0800 Subject: [PATCH] train.py format and README --- fluid/recommendation/gru4rec/README.md | 11 +++++------ fluid/recommendation/gru4rec/train.py | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fluid/recommendation/gru4rec/README.md b/fluid/recommendation/gru4rec/README.md index 81137405..d4489bfb 100644 --- a/fluid/recommendation/gru4rec/README.md +++ b/fluid/recommendation/gru4rec/README.md @@ -74,17 +74,16 @@ python convert_format.py ``` ## 训练 ---use_cuda 表示使用gpu --parallel 表示多卡 +'--use_cuda 1' 表示使用gpu --parallel 1 表示多卡 GPU 环境 -运行命令 `CUDA_VISIBLE_DEVICES=0 python train.py train_file test_file --use_cuda` 开始训练模型。 - -```python -CUDA_VISIBLE_DEVICES=0 python train.py small_train.txt small_test.txt --use_cuda +运行命令 `CUDA_VISIBLE_DEVICES=0 python train.py train_file test_file --use_cuda 1` 开始训练模型。 +``` +CUDA_VISIBLE_DEVICES=0 python train.py small_train.txt small_test.txt --use_cuda 1 ``` CPU 环境 运行命令 `python train.py train_file test_file` 开始训练模型。 -```python +``` python train.py small_train.txt small_test.txt ``` diff --git a/fluid/recommendation/gru4rec/train.py b/fluid/recommendation/gru4rec/train.py index 5474c828..12bc1bc2 100644 --- a/fluid/recommendation/gru4rec/train.py +++ b/fluid/recommendation/gru4rec/train.py @@ -185,6 +185,7 @@ def train_net(): test_file = args.test_file use_cuda = True if args.use_cuda else False parallel = True if args.parallel else False + print("use_cuda:", use_cuda, "parallel:", parallel) batch_size = 50 vocab, train_reader, test_reader = utils.prepare_data( train_file, test_file,batch_size=batch_size * get_cards(args),\ -- GitLab