Prune `DeprecatedTrainerAttributes` (#9598)

This commit is contained in:
Danielle Pintz 2021-09-21 10:31:53 -07:00 committed by GitHub
parent 61b4e33d94
commit 74c3536e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 29 deletions

View File

@ -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

View File

@ -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: