From 03dbae4ce06f091d4f3432c64ddd884f3d883e2e Mon Sep 17 00:00:00 2001 From: Guo Sheng Date: Wed, 17 Jul 2019 10:24:01 +0800 Subject: [PATCH] Fix the defalut value of CPU_NUM to be consistent with Paddle framework. (#2823) Fix the leaving out of subprocess importing. --- PaddleNLP/neural_machine_translation/transformer/train.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PaddleNLP/neural_machine_translation/transformer/train.py b/PaddleNLP/neural_machine_translation/transformer/train.py index aa6a9935..fd27820b 100644 --- a/PaddleNLP/neural_machine_translation/transformer/train.py +++ b/PaddleNLP/neural_machine_translation/transformer/train.py @@ -4,6 +4,7 @@ import copy import logging import multiprocessing import os +import subprocess if os.environ.get('FLAGS_eager_delete_tensor_gb', None) is None: os.environ['FLAGS_eager_delete_tensor_gb'] = '0' @@ -667,7 +668,8 @@ def train(args): if training_role == "PSERVER" or (not TrainTaskConfig.use_gpu): place = fluid.CPUPlace() - dev_count = int(os.environ.get('CPU_NUM', multiprocessing.cpu_count())) + # the default setting of CPU_NUM in paddle framework is 1 + dev_count = int(os.environ.get('CPU_NUM', 1)) else: check_cuda(TrainTaskConfig.use_gpu) gpu_id = int(os.environ.get('FLAGS_selected_gpus', 0)) -- GitLab