From 362bdf65e1d0b815f0baec4faa1256d8e61197e9 Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Sun, 5 May 2019 13:32:57 +0800 Subject: [PATCH] Hide core usage (#2179) --- PaddleNLP/reading_comprehension/src/run.py | 3 +-- PaddleNLP/similarity_net/run_classifier.py | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/PaddleNLP/reading_comprehension/src/run.py b/PaddleNLP/reading_comprehension/src/run.py index 04379557..6f28338d 100644 --- a/PaddleNLP/reading_comprehension/src/run.py +++ b/PaddleNLP/reading_comprehension/src/run.py @@ -26,7 +26,6 @@ import multiprocessing import paddle import paddle.fluid as fluid -import paddle.fluid.core as core import paddle.fluid.framework as framework from paddle.fluid.executor import Executor @@ -388,7 +387,7 @@ def train(logger, args): optimizer.minimize(obj_func) # initialize parameters - place = core.CUDAPlace(0) if args.use_gpu else core.CPUPlace() + place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace() exe = Executor(place) if args.load_dir: logger.info('load from {}'.format(args.load_dir)) diff --git a/PaddleNLP/similarity_net/run_classifier.py b/PaddleNLP/similarity_net/run_classifier.py index bf93adac..1b9940ec 100644 --- a/PaddleNLP/similarity_net/run_classifier.py +++ b/PaddleNLP/similarity_net/run_classifier.py @@ -87,9 +87,9 @@ def train(conf_dict, args): metric = fluid.metrics.Auc(name="auc") # Get device if args.use_cuda: - place = fluid.core.CUDAPlace(0) + place = fluid.CUDAPlace(0) else: - place = fluid.core.CPUPlace() + place = fluid.CPUPlace() simnet_process = reader.SimNetProcessor(args, vocab) if args.task_mode == "pairwise": @@ -244,9 +244,9 @@ def test(conf_dict, args): model_path = args.init_checkpoint # Get device if args.use_cuda: - place = fluid.core.CUDAPlace(0) + place = fluid.CUDAPlace(0) else: - place = fluid.core.CPUPlace() + place = fluid.CPUPlace() # Get executor executor = fluid.Executor(place=place) # Load model @@ -302,9 +302,9 @@ def infer(args): model_path = args.init_checkpoint # Get device if args.use_cuda: - place = fluid.core.CUDAPlace(0) + place = fluid.CUDAPlace(0) else: - place = fluid.core.CPUPlace() + place = fluid.CPUPlace() # Get executor executor = fluid.Executor(place=place) # Load model -- GitLab