From 74c3536e62aeb375c3591f7099e72cd60d60c2f7 Mon Sep 17 00:00:00 2001 From: Danielle Pintz <38207072+daniellepintz@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:31:53 -0700 Subject: [PATCH] Prune `DeprecatedTrainerAttributes` (#9598) --- pytorch_lightning/trainer/deprecated_api.py | 27 --------------------- pytorch_lightning/trainer/trainer.py | 9 +++++-- 2 files changed, 7 insertions(+), 29 deletions(-) delete mode 100644 pytorch_lightning/trainer/deprecated_api.py diff --git a/pytorch_lightning/trainer/deprecated_api.py b/pytorch_lightning/trainer/deprecated_api.py deleted file mode 100644 index e4f0f410fc..0000000000 --- a/pytorch_lightning/trainer/deprecated_api.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright The PyTorch Lightning team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from pytorch_lightning.loops import FitLoop -from pytorch_lightning.utilities import rank_zero_deprecation - - -class DeprecatedTrainerAttributes: - - fit_loop: FitLoop - - @property - def train_loop(self) -> FitLoop: - rank_zero_deprecation( - "`Trainer.train_loop` has been renamed to `Trainer.fit_loop` and will be removed in v1.6." - ) - return self.fit_loop diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py index 7cabcb2926..2e115decf3 100644 --- a/pytorch_lightning/trainer/trainer.py +++ b/pytorch_lightning/trainer/trainer.py @@ -62,7 +62,6 @@ from pytorch_lightning.trainer.connectors.optimizer_connector import OptimizerCo from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.trainer.connectors.training_trick_connector import TrainingTricksConnector from pytorch_lightning.trainer.data_loading import TrainerDataLoadingMixin -from pytorch_lightning.trainer.deprecated_api import DeprecatedTrainerAttributes from pytorch_lightning.trainer.model_hooks import TrainerModelHooksMixin from pytorch_lightning.trainer.optimizers import TrainerOptimizersMixin from pytorch_lightning.trainer.states import RunningStage, TrainerFn, TrainerState, TrainerStatus @@ -114,7 +113,6 @@ class Trainer( TrainerModelHooksMixin, TrainerOptimizersMixin, TrainerDataLoadingMixin, - DeprecatedTrainerAttributes, ): # Needed because of LightningOptimizer _lightning_optimizers = None @@ -1957,6 +1955,13 @@ class Trainer( if self.predicting: return self.predict_loop + @property + def train_loop(self) -> FitLoop: + rank_zero_deprecation( + "`Trainer.train_loop` has been renamed to `Trainer.fit_loop` and will be removed in v1.6." + ) + return self.fit_loop + @property def _ckpt_path(self) -> Optional[str]: if self.state.fn == TrainerFn.VALIDATING: