diff --git a/python/paddle/distributed/fleet/launch_utils.py b/python/paddle/distributed/fleet/launch_utils.py index ee5eb807fad7019cd2b7dff85170325a6d8230d1..4b1eef72ee917782e2073af9cbd1b4678169bd69 100644 --- a/python/paddle/distributed/fleet/launch_utils.py +++ b/python/paddle/distributed/fleet/launch_utils.py @@ -29,6 +29,7 @@ import struct import paddle import paddle.fluid as fluid +from distutils.util import strtobool logger = logging.getLogger("root") logger.propagate = False @@ -349,7 +350,7 @@ def add_arguments(argname, type, default, help, argparser, **kwargs): add_argument("name", str, "Jonh", "User name.", parser) args = parser.parse_args() """ - type = distutils.util.strtobool if type == bool else type + type = strtobool if type == bool else type argparser.add_argument( "--" + argname, default=default, @@ -685,7 +686,7 @@ def get_device_proc_info(args): gpus = get_gpus(args.gpus) if args.nproc_per_node is not None: assert (len(gpus) % int(args.nproc_per_node)) ==0, \ - "gpus' number:{} mod args.nproc_per_node:{} must == 0".format(len(gpus), arg.nproc_per_node) + "gpus' number:{} mod args.nproc_per_node:{} must == 0".format(len(gpus), args.nproc_per_node) n = int(len(gpus) / int(args.nproc_per_node)) devices_per_proc = [ @@ -699,7 +700,7 @@ def get_device_proc_info(args): xpus = get_xpus(args.xpus) if args.nproc_per_node is not None: assert (len(xpus) % int(args.nproc_per_node)) == 0, \ - "xpus' number:{} mod args.nproc_per_node:{} must == 0".format(len(xpus), arg.nproc_per_node) + "xpus' number:{} mod args.nproc_per_node:{} must == 0".format(len(xpus), args.nproc_per_node) n = int(len(xpus) / int(args.nproc_per_node)) devices_per_proc = [ diff --git a/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_1d.py b/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_1d.py index ee4b2c002f5afaf390b42e13e5cf7f34906cd90a..6ebc89b18738c78fcf2a407910de38511b7afa1e 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_1d.py +++ b/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_1d.py @@ -15,6 +15,7 @@ from __future__ import print_function +import unittest import paddle from paddle.fluid.contrib import sparsity from paddle.fluid.tests.unittests.asp.asp_pruning_base import TestASPHelperPruningBase diff --git a/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_2d_greedy.py b/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_2d_greedy.py index 4bdd310f0209a94f639b107e7279726e196e6a7d..8ec8ab485250e065993a01236a14cdc4eb4261cf 100644 --- a/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_2d_greedy.py +++ b/python/paddle/fluid/tests/unittests/asp/test_asp_pruning_2d_greedy.py @@ -15,6 +15,7 @@ from __future__ import print_function +import unittest import paddle from paddle.fluid.contrib import sparsity from paddle.fluid.tests.unittests.asp.asp_pruning_base import TestASPHelperPruningBase diff --git a/python/paddle/fluid/tests/unittests/parallel_dygraph_transformer.py b/python/paddle/fluid/tests/unittests/parallel_dygraph_transformer.py index cfc2ccd4cf7beecd0867582f5cdb5ca8da7a43c5..f149637641add4ef9178aacbc4d6b265b663ca72 100644 --- a/python/paddle/fluid/tests/unittests/parallel_dygraph_transformer.py +++ b/python/paddle/fluid/tests/unittests/parallel_dygraph_transformer.py @@ -20,6 +20,7 @@ import six import paddle import paddle.fluid as fluid from paddle.fluid.dygraph import Embedding, LayerNorm, Linear, to_variable, Layer +from paddle.optimizer.lr import NoamDecay from test_dist_base import runtime_main, TestParallelDyGraphRunnerBase """ diff --git a/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py b/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py index 1cdec863b2ac3d0b4d845e1f59aebe57baa6d4c2..8132a78f696756eebf09b4dee4fe8e47aed34f88 100644 --- a/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py +++ b/python/paddle/fluid/tests/unittests/xpu/test_batch_norm_op_xpu.py @@ -141,7 +141,7 @@ class TestXPUBatchNormOp(unittest.TestCase): else: raise ValueError( "Unsupported data layout! Only NCHW and NHWC is supported, but received " - + data_layout) + + self.data_layout) np.random.seed(1024) self.x_np = np.random.random_sample(self.shape).astype(self.dtype) self.scale_np = np.random.random_sample( diff --git a/tools/CrossStackProfiler/NetFileReader.py b/tools/CrossStackProfiler/NetFileReader.py index 29c2ae85e60458f6b712e3eeadb739a2dee70d09..fe900fab2ad24bd6b52ec71d0e0d44fe38adf28b 100755 --- a/tools/CrossStackProfiler/NetFileReader.py +++ b/tools/CrossStackProfiler/NetFileReader.py @@ -17,6 +17,7 @@ import json import glob import logging import pandas as pd +import multiprocessing from multiprocessing import Process