diff --git a/fluid/text_matching_on_quora/train_and_evaluate.py b/fluid/text_matching_on_quora/train_and_evaluate.py index f6000def35b5c684ea6f309a51225d1d5cabd7e2..e998bf26e65a7bc3479f737ed38e5d96b5f538e6 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()