未验证 提交 ab1babbb 编写于 作者: N Nyakku Shigure 提交者: GitHub

[CodeStyle][F401] remove unused imports in unittests/distributed_passes,tokenizer,sequence (#46793)

* [CodeStyle][F401] remove unused imports in unittests/distributed_passes,tokenizer,sequence

* add noqa after required imports
上级 300b1009
...@@ -14,12 +14,8 @@ ...@@ -14,12 +14,8 @@
import paddle import paddle
import os import os
import random
import sys import sys
import pickle import pickle
import shlex
import shutil
import inspect
import numpy as np import numpy as np
from collections import OrderedDict from collections import OrderedDict
from dist_pass_test_base import DistPassTestBase from dist_pass_test_base import DistPassTestBase
......
...@@ -23,7 +23,7 @@ import inspect ...@@ -23,7 +23,7 @@ import inspect
import numpy as np import numpy as np
from collections import OrderedDict from collections import OrderedDict
from paddle.distributed.fleet.launch_utils import run_with_coverage from paddle.distributed.fleet.launch_utils import run_with_coverage
from paddle.distributed.passes.pass_base import new_pass, PassBase, PassManager from paddle.distributed.passes.pass_base import PassBase, PassManager
def prepare_python_path_and_return_module(path): def prepare_python_path_and_return_module(path):
......
...@@ -17,7 +17,6 @@ import paddle ...@@ -17,7 +17,6 @@ import paddle
import pickle import pickle
import importlib import importlib
import os import os
import sys
from paddle.distributed.fleet.launch_utils import run_with_coverage from paddle.distributed.fleet.launch_utils import run_with_coverage
from dist_pass_test_base import prepare_python_path_and_return_module, DistPassTestBase from dist_pass_test_base import prepare_python_path_and_return_module, DistPassTestBase
......
...@@ -13,18 +13,11 @@ ...@@ -13,18 +13,11 @@
# limitations under the License. # limitations under the License.
import os import os
import random
import sys import sys
import pickle
import shlex import shlex
import shutil
import inspect
import unittest import unittest
import numpy as np from paddle.fluid.tests.unittests.distributed_passes.dist_pass_test_base import ( # noqa: F401
from collections import OrderedDict prepare_python_path_and_return_module, remove_path_if_exists)
from paddle.distributed.ps.utils.public import logger
from paddle.fluid.tests.unittests.distributed_passes.dist_pass_test_base import prepare_python_path_and_return_module, remove_path_if_exists
import paddle.distributed.fleet as fleet
class PsPassTestBase(unittest.TestCase): class PsPassTestBase(unittest.TestCase):
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import random import random
import numpy as np import numpy as np
......
...@@ -18,16 +18,12 @@ import numpy as np ...@@ -18,16 +18,12 @@ import numpy as np
import unittest import unittest
import paddle import paddle
import paddle.nn as nn
import paddle.distributed.fleet as fleet import paddle.distributed.fleet as fleet
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.dist_context import get_default_distributed_context from paddle.distributed.auto_parallel.dist_context import get_default_distributed_context
from paddle.distributed.passes import new_pass, PassManager, PassContext from paddle.distributed.passes import PassContext, new_pass
from auto_parallel_pass_test_base import AutoPallelPassTestBase from auto_parallel_pass_test_base import AutoPallelPassTestBase
sys.path.append("..") sys.path.append("..")
import auto_parallel_gpt_model as modeling
from auto_parallel_gpt_model import GPTModel, GPTForPretraining, GPTPretrainingCriterion
class TestDataParallelPassWithScale1(AutoPallelPassTestBase): class TestDataParallelPassWithScale1(AutoPallelPassTestBase):
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import random import random
import numpy as np import numpy as np
......
...@@ -12,12 +12,9 @@ ...@@ -12,12 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import time
import unittest import unittest
import random import random
import numpy as np import numpy as np
import os
import shutil
import logging import logging
import paddle import paddle
......
...@@ -12,16 +12,12 @@ ...@@ -12,16 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import random import random
import numpy as np import numpy as np
import unittest import unittest
import paddle import paddle
import paddle.nn as nn
import paddle.distributed.fleet as fleet import paddle.distributed.fleet as fleet
from paddle.distributed.fleet import auto
from paddle.distributed.passes import new_pass, PassManager
from auto_parallel_pass_test_base import AutoPallelPassTestBase from auto_parallel_pass_test_base import AutoPallelPassTestBase
......
...@@ -18,15 +18,10 @@ import numpy as np ...@@ -18,15 +18,10 @@ import numpy as np
import unittest import unittest
import paddle import paddle
import paddle.nn as nn
import paddle.distributed.fleet as fleet import paddle.distributed.fleet as fleet
from paddle.distributed.fleet import auto
from paddle.distributed.passes import new_pass, PassManager
from auto_parallel_pass_test_base import AutoPallelPassTestBase from auto_parallel_pass_test_base import AutoPallelPassTestBase
sys.path.append("..") sys.path.append("..")
import auto_parallel_gpt_model as modeling
from auto_parallel_gpt_model import GPTModel, GPTForPretraining, GPTPretrainingCriterion
class TestShardingPass(AutoPallelPassTestBase): class TestShardingPass(AutoPallelPassTestBase):
......
...@@ -12,12 +12,8 @@ ...@@ -12,12 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import unittest import unittest
import numpy as np from ps_pass_test_base import PsPassTestBase
import paddle
from ps_pass_test_base import *
from paddle.fluid.tests.unittests.ps.ps_dnn_trainer import DnnTrainer
class TestPsServerPass(PsPassTestBase): class TestPsServerPass(PsPassTestBase):
......
...@@ -12,14 +12,10 @@ ...@@ -12,14 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import unittest import unittest
import numpy as np
import paddle from ps_pass_test_base import remove_path_if_exists, PsPassTestBase
from ps_pass_test_base import *
from paddle.distributed.ps.utils.public import logger, ps_log_root_dir from paddle.distributed.ps.utils.public import logger, ps_log_root_dir
from paddle.fluid.tests.unittests.ps.ps_dnn_trainer import DnnTrainer
class TestPsTrainerPass(PsPassTestBase): class TestPsTrainerPass(PsPassTestBase):
......
...@@ -12,15 +12,12 @@ ...@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.framework import convert_np_dtype_to_dtype_, Program, program_guard from paddle.fluid.framework import Program, program_guard
import paddle.fluid.core as core
import numpy as np import numpy as np
import copy
import unittest import unittest
import sys import sys
sys.path.append("../") sys.path.append("../")
from op_test import OpTest
class TestSequenceFirstStepOpError(unittest.TestCase): class TestSequenceFirstStepOpError(unittest.TestCase):
......
...@@ -12,15 +12,12 @@ ...@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.framework import convert_np_dtype_to_dtype_, Program, program_guard from paddle.fluid.framework import Program, program_guard
import paddle.fluid.core as core
import numpy as np import numpy as np
import copy
import unittest import unittest
import sys import sys
sys.path.append("../") sys.path.append("../")
from op_test import OpTest
class TestSequenceLastStepOpError(unittest.TestCase): class TestSequenceLastStepOpError(unittest.TestCase):
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.framework import convert_np_dtype_to_dtype_, Program, program_guard from paddle.fluid.framework import convert_np_dtype_to_dtype_, Program, program_guard
import paddle.fluid.core as core
import numpy as np import numpy as np
import copy
import unittest import unittest
import sys import sys
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import unittest import unittest
import numpy as np import numpy as np
import math
import sys import sys
sys.path.append("../") sys.path.append("../")
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import unittest import unittest
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
import numpy as np import numpy as np
import sys import sys
......
...@@ -13,11 +13,7 @@ ...@@ -13,11 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import copy
import io
import json
import os import os
import six
import unicodedata import unicodedata
from tokenizer_utils import PretrainedTokenizer from tokenizer_utils import PretrainedTokenizer
......
...@@ -20,7 +20,7 @@ import json ...@@ -20,7 +20,7 @@ import json
import os import os
import unicodedata import unicodedata
from shutil import copyfile from shutil import copyfile
from typing import Iterable, Iterator, Optional, List, Any, Callable, Union from typing import Optional
from paddle.dataset.common import DATA_HOME from paddle.dataset.common import DATA_HOME
from paddle.utils.download import get_path_from_url from paddle.utils.download import get_path_from_url
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册