From 02416d0a5ffe1a21f0ad09083bf9483da31d262e Mon Sep 17 00:00:00 2001 From: mapingshuo Date: Fri, 26 Oct 2018 17:07:24 +0800 Subject: [PATCH] Fix 2 bug in train_and_evaluate.py --- fluid/text_matching_on_quora/train_and_evaluate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fluid/text_matching_on_quora/train_and_evaluate.py b/fluid/text_matching_on_quora/train_and_evaluate.py index f6000def..e998bf26 100755 --- a/fluid/text_matching_on_quora/train_and_evaluate.py +++ b/fluid/text_matching_on_quora/train_and_evaluate.py @@ -87,8 +87,8 @@ def evaluate(epoch_id, exe, inference_program, dev_reader, test_reader, fetch_li def train_and_evaluate(train_reader, - test_reader, dev_reader, + test_reader, network, optimizer, global_config, @@ -246,7 +246,10 @@ def main(): # use cuda or not if not global_config.has_member('use_cuda'): - global_config.use_cuda = 'CUDA_VISIBLE_DEVICES' in os.environ + if 'CUDA_VISIBLE_DEVICES' in os.environ and os.environ['CUDA_VISIBLE_DEVICES'] != '': + global_config.use_cuda = True + else: + global_config.use_cuda = False global_config.list_config() -- GitLab