From 1d4b6be17bfac956e93b432517181a61175cbb88 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Wed, 4 Dec 2019 17:39:14 +0100 Subject: [PATCH] rename trainer modules, drop `_mixin` (#571) * rename trainer modules, drop _mixin * fix imports --- .../{amp_mixin.py => auto_mix_precision.py} | 2 +- ...ack_config_mixin.py => callback_config.py} | 0 ...{data_loading_mixin.py => data_loading.py} | 0 ...{ddp_mixin.py => distrib_data_parallel.py} | 0 .../trainer/{dp_mixin.py => distrib_parts.py} | 0 ...ation_loop_mixin.py => evaluation_loop.py} | 0 .../trainer/{logging_mixin.py => logging.py} | 0 .../{model_hooks_mixin.py => model_hooks.py} | 0 pytorch_lightning/trainer/trainer.py | 22 +++++++++---------- .../{train_loop_mixin.py => training_loop.py} | 0 ...ing_tricks_mixin.py => training_tricks.py} | 0 tests/test_gpu_models.py | 2 +- tests/test_trainer.py | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) rename pytorch_lightning/trainer/{amp_mixin.py => auto_mix_precision.py} (90%) rename pytorch_lightning/trainer/{callback_config_mixin.py => callback_config.py} (100%) rename pytorch_lightning/trainer/{data_loading_mixin.py => data_loading.py} (100%) rename pytorch_lightning/trainer/{ddp_mixin.py => distrib_data_parallel.py} (100%) rename pytorch_lightning/trainer/{dp_mixin.py => distrib_parts.py} (100%) rename pytorch_lightning/trainer/{evaluation_loop_mixin.py => evaluation_loop.py} (100%) rename pytorch_lightning/trainer/{logging_mixin.py => logging.py} (100%) rename pytorch_lightning/trainer/{model_hooks_mixin.py => model_hooks.py} (100%) rename pytorch_lightning/trainer/{train_loop_mixin.py => training_loop.py} (100%) rename pytorch_lightning/trainer/{training_tricks_mixin.py => training_tricks.py} (100%) diff --git a/pytorch_lightning/trainer/amp_mixin.py b/pytorch_lightning/trainer/auto_mix_precision.py similarity index 90% rename from pytorch_lightning/trainer/amp_mixin.py rename to pytorch_lightning/trainer/auto_mix_precision.py index 481ea98f88..b28193c0bd 100644 --- a/pytorch_lightning/trainer/amp_mixin.py +++ b/pytorch_lightning/trainer/auto_mix_precision.py @@ -18,7 +18,7 @@ class TrainerAMPMixin(ABC): if use_amp and not APEX_AVAILABLE: # pragma: no cover msg = """ - You set use_amp=True but do not have apex installed. + You set `use_amp=True` but do not have apex installed. Install apex first using this guide and rerun with use_amp=True: https://github.com/NVIDIA/apex#linux diff --git a/pytorch_lightning/trainer/callback_config_mixin.py b/pytorch_lightning/trainer/callback_config.py similarity index 100% rename from pytorch_lightning/trainer/callback_config_mixin.py rename to pytorch_lightning/trainer/callback_config.py diff --git a/pytorch_lightning/trainer/data_loading_mixin.py b/pytorch_lightning/trainer/data_loading.py similarity index 100% rename from pytorch_lightning/trainer/data_loading_mixin.py rename to pytorch_lightning/trainer/data_loading.py diff --git a/pytorch_lightning/trainer/ddp_mixin.py b/pytorch_lightning/trainer/distrib_data_parallel.py similarity index 100% rename from pytorch_lightning/trainer/ddp_mixin.py rename to pytorch_lightning/trainer/distrib_data_parallel.py diff --git a/pytorch_lightning/trainer/dp_mixin.py b/pytorch_lightning/trainer/distrib_parts.py similarity index 100% rename from pytorch_lightning/trainer/dp_mixin.py rename to pytorch_lightning/trainer/distrib_parts.py diff --git a/pytorch_lightning/trainer/evaluation_loop_mixin.py b/pytorch_lightning/trainer/evaluation_loop.py similarity index 100% rename from pytorch_lightning/trainer/evaluation_loop_mixin.py rename to pytorch_lightning/trainer/evaluation_loop.py diff --git a/pytorch_lightning/trainer/logging_mixin.py b/pytorch_lightning/trainer/logging.py similarity index 100% rename from pytorch_lightning/trainer/logging_mixin.py rename to pytorch_lightning/trainer/logging.py diff --git a/pytorch_lightning/trainer/model_hooks_mixin.py b/pytorch_lightning/trainer/model_hooks.py similarity index 100% rename from pytorch_lightning/trainer/model_hooks_mixin.py rename to pytorch_lightning/trainer/model_hooks.py diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py index 319004a4a2..79c86d1c77 100644 --- a/pytorch_lightning/trainer/trainer.py +++ b/pytorch_lightning/trainer/trainer.py @@ -13,21 +13,21 @@ import torch.multiprocessing as mp import tqdm from torch.optim.optimizer import Optimizer -from pytorch_lightning.trainer.amp_mixin import TrainerAMPMixin -from pytorch_lightning.trainer.callback_config_mixin import TrainerCallbackConfigMixin -from pytorch_lightning.trainer.data_loading_mixin import TrainerDataLoadingMixin -from pytorch_lightning.trainer.ddp_mixin import TrainerDDPMixin -from pytorch_lightning.trainer.dp_mixin import TrainerDPMixin -from pytorch_lightning.trainer.dp_mixin import ( +from pytorch_lightning.trainer.auto_mix_precision import TrainerAMPMixin +from pytorch_lightning.trainer.callback_config import TrainerCallbackConfigMixin +from pytorch_lightning.trainer.data_loading import TrainerDataLoadingMixin +from pytorch_lightning.trainer.distrib_data_parallel import TrainerDDPMixin +from pytorch_lightning.trainer.distrib_parts import ( + TrainerDPMixin, parse_gpu_ids, determine_root_gpu_device ) -from pytorch_lightning.trainer.evaluation_loop_mixin import TrainerEvaluationLoopMixin -from pytorch_lightning.trainer.logging_mixin import TrainerLoggingMixin -from pytorch_lightning.trainer.model_hooks_mixin import TrainerModelHooksMixin -from pytorch_lightning.trainer.train_loop_mixin import TrainerTrainLoopMixin +from pytorch_lightning.trainer.evaluation_loop import TrainerEvaluationLoopMixin +from pytorch_lightning.trainer.logging import TrainerLoggingMixin +from pytorch_lightning.trainer.model_hooks import TrainerModelHooksMixin +from pytorch_lightning.trainer.training_loop import TrainerTrainLoopMixin from pytorch_lightning.trainer.trainer_io import TrainerIOMixin -from pytorch_lightning.trainer.training_tricks_mixin import TrainerTrainingTricksMixin +from pytorch_lightning.trainer.training_tricks import TrainerTrainingTricksMixin from pytorch_lightning.utilities.debugging import MisconfigurationException try: diff --git a/pytorch_lightning/trainer/train_loop_mixin.py b/pytorch_lightning/trainer/training_loop.py similarity index 100% rename from pytorch_lightning/trainer/train_loop_mixin.py rename to pytorch_lightning/trainer/training_loop.py diff --git a/pytorch_lightning/trainer/training_tricks_mixin.py b/pytorch_lightning/trainer/training_tricks.py similarity index 100% rename from pytorch_lightning/trainer/training_tricks_mixin.py rename to pytorch_lightning/trainer/training_tricks.py diff --git a/tests/test_gpu_models.py b/tests/test_gpu_models.py index 216f345a8d..68b1fe2f2a 100644 --- a/tests/test_gpu_models.py +++ b/tests/test_gpu_models.py @@ -12,7 +12,7 @@ from pytorch_lightning.core import memory from pytorch_lightning.testing import ( LightningTestModel, ) -from pytorch_lightning.trainer.dp_mixin import ( +from pytorch_lightning.trainer.distrib_parts import ( parse_gpu_ids, determine_root_gpu_device, ) diff --git a/tests/test_trainer.py b/tests/test_trainer.py index 3564c2a703..c02ba6a1a9 100644 --- a/tests/test_trainer.py +++ b/tests/test_trainer.py @@ -16,7 +16,7 @@ from pytorch_lightning.testing import ( LightningTestMultipleDataloadersMixin, ) from pytorch_lightning.trainer import trainer_io -from pytorch_lightning.trainer.logging_mixin import TrainerLoggingMixin +from pytorch_lightning.trainer.logging import TrainerLoggingMixin def test_no_val_module(tmpdir):