From 60d0b1361d72b71b78d0a898dd6ecf9bcecdd4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Sat, 13 Feb 2021 00:08:35 +0100 Subject: [PATCH 1/3] move tests --- benchmarks/test_sharded_parity.py | 2 +- tests/accelerators/__init__.py | 12 ++++++++++++ tests/accelerators/{legacy => }/ddp_model.py | 0 tests/accelerators/legacy/__init__.py | 14 -------------- .../{legacy => }/test_accelerator_connector.py | 0 tests/accelerators/{legacy => }/test_ddp.py | 3 ++- tests/accelerators/{legacy => }/test_ddp_spawn.py | 0 tests/accelerators/{legacy => }/test_dp.py | 0 .../{legacy => }/test_multi_nodes_gpu.py | 0 .../accelerators/{legacy => }/test_tpu_backend.py | 0 tests/trainer/properties/test_get_model.py | 2 +- 11 files changed, 16 insertions(+), 17 deletions(-) rename tests/accelerators/{legacy => }/ddp_model.py (100%) delete mode 100644 tests/accelerators/legacy/__init__.py rename tests/accelerators/{legacy => }/test_accelerator_connector.py (100%) rename tests/accelerators/{legacy => }/test_ddp.py (97%) rename tests/accelerators/{legacy => }/test_ddp_spawn.py (100%) rename tests/accelerators/{legacy => }/test_dp.py (100%) rename tests/accelerators/{legacy => }/test_multi_nodes_gpu.py (100%) rename tests/accelerators/{legacy => }/test_tpu_backend.py (100%) diff --git a/benchmarks/test_sharded_parity.py b/benchmarks/test_sharded_parity.py index f0476ffb7e155..a5fd6c2eff0df 100644 --- a/benchmarks/test_sharded_parity.py +++ b/benchmarks/test_sharded_parity.py @@ -23,7 +23,7 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.plugins import DDPSpawnShardedPlugin from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE, _NATIVE_AMP_AVAILABLE -from tests.accelerators.legacy import DDPLauncher +from tests.accelerators import DDPLauncher from tests.helpers.boring_model import BoringModel, RandomDataset diff --git a/tests/accelerators/__init__.py b/tests/accelerators/__init__.py index e69de29bb2d1d..71bdd208e51ad 100644 --- a/tests/accelerators/__init__.py +++ b/tests/accelerators/__init__.py @@ -0,0 +1,12 @@ +try: + from dtrun.launcher import DDPLauncher +except ImportError: + + class DDPLauncher: + + def run(cmd_line, **kwargs): + + def inner(func): + pass + + return inner \ No newline at end of file diff --git a/tests/accelerators/legacy/ddp_model.py b/tests/accelerators/ddp_model.py similarity index 100% rename from tests/accelerators/legacy/ddp_model.py rename to tests/accelerators/ddp_model.py diff --git a/tests/accelerators/legacy/__init__.py b/tests/accelerators/legacy/__init__.py deleted file mode 100644 index 273f70080d7ec..0000000000000 --- a/tests/accelerators/legacy/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# todo: feel free to move any of these "legacy" tests up... - -try: - from dtrun.launcher import DDPLauncher -except ImportError: - - class DDPLauncher: - - def run(cmd_line, **kwargs): - - def inner(func): - pass - - return inner diff --git a/tests/accelerators/legacy/test_accelerator_connector.py b/tests/accelerators/test_accelerator_connector.py similarity index 100% rename from tests/accelerators/legacy/test_accelerator_connector.py rename to tests/accelerators/test_accelerator_connector.py diff --git a/tests/accelerators/legacy/test_ddp.py b/tests/accelerators/test_ddp.py similarity index 97% rename from tests/accelerators/legacy/test_ddp.py rename to tests/accelerators/test_ddp.py index 48cef6d595946..089d1ed14c6d3 100644 --- a/tests/accelerators/legacy/test_ddp.py +++ b/tests/accelerators/test_ddp.py @@ -16,7 +16,8 @@ import pytest import torch -from tests.accelerators.legacy import ddp_model, DDPLauncher +from tests.accelerators import DDPLauncher +from tests.accelerators import ddp_model from tests.utilities.distributed import call_training_script diff --git a/tests/accelerators/legacy/test_ddp_spawn.py b/tests/accelerators/test_ddp_spawn.py similarity index 100% rename from tests/accelerators/legacy/test_ddp_spawn.py rename to tests/accelerators/test_ddp_spawn.py diff --git a/tests/accelerators/legacy/test_dp.py b/tests/accelerators/test_dp.py similarity index 100% rename from tests/accelerators/legacy/test_dp.py rename to tests/accelerators/test_dp.py diff --git a/tests/accelerators/legacy/test_multi_nodes_gpu.py b/tests/accelerators/test_multi_nodes_gpu.py similarity index 100% rename from tests/accelerators/legacy/test_multi_nodes_gpu.py rename to tests/accelerators/test_multi_nodes_gpu.py diff --git a/tests/accelerators/legacy/test_tpu_backend.py b/tests/accelerators/test_tpu_backend.py similarity index 100% rename from tests/accelerators/legacy/test_tpu_backend.py rename to tests/accelerators/test_tpu_backend.py diff --git a/tests/trainer/properties/test_get_model.py b/tests/trainer/properties/test_get_model.py index 37e495f7e5214..73e900072b7e0 100644 --- a/tests/trainer/properties/test_get_model.py +++ b/tests/trainer/properties/test_get_model.py @@ -17,7 +17,7 @@ import torch from pytorch_lightning import Trainer -from tests.accelerators.legacy import DDPLauncher +from tests.accelerators import DDPLauncher from tests.helpers.boring_model import BoringModel From c4dc2ba643ebc096b2e184c83b24f34923f52471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Sat, 13 Feb 2021 00:17:57 +0100 Subject: [PATCH 2/3] isort --- tests/accelerators/__init__.py | 2 +- tests/accelerators/test_ddp.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/accelerators/__init__.py b/tests/accelerators/__init__.py index 71bdd208e51ad..9583ec9537437 100644 --- a/tests/accelerators/__init__.py +++ b/tests/accelerators/__init__.py @@ -9,4 +9,4 @@ def run(cmd_line, **kwargs): def inner(func): pass - return inner \ No newline at end of file + return inner diff --git a/tests/accelerators/test_ddp.py b/tests/accelerators/test_ddp.py index 089d1ed14c6d3..1bd9e36d4f205 100644 --- a/tests/accelerators/test_ddp.py +++ b/tests/accelerators/test_ddp.py @@ -16,8 +16,7 @@ import pytest import torch -from tests.accelerators import DDPLauncher -from tests.accelerators import ddp_model +from tests.accelerators import ddp_model, DDPLauncher from tests.utilities.distributed import call_training_script From 3857a695db6bb4d7e69e981fb4fdca16cf75144d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Sat, 13 Feb 2021 00:42:14 +0100 Subject: [PATCH 3/3] mv --- dockers/tpu-tests/tpu_test_cases.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/tpu-tests/tpu_test_cases.jsonnet b/dockers/tpu-tests/tpu_test_cases.jsonnet index 03cd3b7b65517..8c3f3693fda50 100644 --- a/dockers/tpu-tests/tpu_test_cases.jsonnet +++ b/dockers/tpu-tests/tpu_test_cases.jsonnet @@ -23,7 +23,7 @@ local tputests = base.BaseTest { cd pytorch-lightning coverage run --source=pytorch_lightning -m pytest -v --capture=no \ pytorch_lightning/utilities/xla_device_utils.py \ - tests/accelerators/legacy/test_tpu_backend.py \ + tests/accelerators/test_tpu_backend.py \ tests/models/test_tpu.py test_exit_code=$? echo "\n||| END PYTEST LOGS |||\n"