From d4414cbbc159e026eb2a8dc192122be023ac3008 Mon Sep 17 00:00:00 2001 From: chengduo Date: Mon, 9 Jul 2018 10:38:08 +0800 Subject: [PATCH] Fix get WITH_GPU bug (#565) --- 02.recognize_digits/train.py | 2 +- 04.word2vec/train.py | 4 ++-- 06.understand_sentiment/train_conv.py | 2 +- 06.understand_sentiment/train_dyn_rnn.py | 2 +- 06.understand_sentiment/train_stacked_lstm.py | 2 +- 08.machine_translation/train.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/02.recognize_digits/train.py b/02.recognize_digits/train.py index 8b91432..050474b 100644 --- a/02.recognize_digits/train.py +++ b/02.recognize_digits/train.py @@ -73,7 +73,7 @@ def main(): test_reader = paddle.batch(paddle.dataset.mnist.test(), batch_size=64) - use_cuda = os.getenv('WITH_GPU', '0') != '0' + use_cuda = False # set to True if training with GPU place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace() trainer = fluid.Trainer( diff --git a/04.word2vec/train.py b/04.word2vec/train.py index f8e394d..a9f1d3c 100644 --- a/04.word2vec/train.py +++ b/04.word2vec/train.py @@ -26,8 +26,8 @@ HIDDEN_SIZE = 256 N = 5 BATCH_SIZE = 100 -# can use CPU or GPU -use_cuda = os.getenv('WITH_GPU', '0') != '0' + +use_cuda = False # set to True if training with GPU word_dict = paddle.dataset.imikolov.build_dict() dict_size = len(word_dict) diff --git a/06.understand_sentiment/train_conv.py b/06.understand_sentiment/train_conv.py index 61fe18e..ee61397 100644 --- a/06.understand_sentiment/train_conv.py +++ b/06.understand_sentiment/train_conv.py @@ -162,5 +162,5 @@ def main(use_cuda): if __name__ == '__main__': - use_cuda = os.getenv('WITH_GPU', '0') != '0' + use_cuda = False # set to True if training with GPU main(use_cuda) diff --git a/06.understand_sentiment/train_dyn_rnn.py b/06.understand_sentiment/train_dyn_rnn.py index ef3be26..e8d2690 100644 --- a/06.understand_sentiment/train_dyn_rnn.py +++ b/06.understand_sentiment/train_dyn_rnn.py @@ -179,5 +179,5 @@ def main(use_cuda): if __name__ == '__main__': - use_cuda = os.getenv('WITH_GPU', '0') != '0' + use_cuda = False # set to True if training with GPU main(use_cuda) diff --git a/06.understand_sentiment/train_stacked_lstm.py b/06.understand_sentiment/train_stacked_lstm.py index 351994f..708c485 100644 --- a/06.understand_sentiment/train_stacked_lstm.py +++ b/06.understand_sentiment/train_stacked_lstm.py @@ -170,5 +170,5 @@ def main(use_cuda): if __name__ == '__main__': - use_cuda = os.getenv('WITH_GPU', '0') != '0' + use_cuda = False # set to True if training with GPU main(use_cuda) diff --git a/08.machine_translation/train.py b/08.machine_translation/train.py index e5d318d..7ae8810 100644 --- a/08.machine_translation/train.py +++ b/08.machine_translation/train.py @@ -128,5 +128,5 @@ def main(use_cuda): if __name__ == '__main__': - use_cuda = os.getenv('WITH_GPU', '0') != '0' + use_cuda = False # set to True if training with GPU main(use_cuda) -- GitLab