From a6489347cafc319d24df065610e8ffee3d2c3359 Mon Sep 17 00:00:00 2001 From: Andres Algaba Date: Sat, 24 Sep 2022 19:22:09 +0200 Subject: [PATCH] Remove the deprecated run_stage (#14870) --- src/pytorch_lightning/CHANGELOG.md | 2 ++ src/pytorch_lightning/trainer/trainer.py | 7 ------- tests/tests_pytorch/deprecated_api/test_remove_1-8.py | 7 ------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md index c12ea445e1..e104da285d 100644 --- a/src/pytorch_lightning/CHANGELOG.md +++ b/src/pytorch_lightning/CHANGELOG.md @@ -221,6 +221,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Removed the deprecated `Trainer.use_amp` and `LightningModule.use_amp` attributes ([#14832](https://github.com/Lightning-AI/lightning/pull/14832)) +- Removed the deprecated `Trainer.run_stage` in favor of `Trainer.{fit,validate,test,predict}` + - Removed the deprecated `SimpleProfiler.profile_iterable` and `AdvancedProfiler.profile_iterable` attributes ([#14864](https://github.com/Lightning-AI/lightning/pull/14864)) diff --git a/src/pytorch_lightning/trainer/trainer.py b/src/pytorch_lightning/trainer/trainer.py index 6f3e0d4ce7..e6952e4fa7 100644 --- a/src/pytorch_lightning/trainer/trainer.py +++ b/src/pytorch_lightning/trainer/trainer.py @@ -1133,13 +1133,6 @@ class Trainer( self._logger_connector.teardown() self._signal_connector.teardown() - def run_stage(self) -> None: - rank_zero_deprecation( - "`Trainer.run_stage` is deprecated in v1.6 and will be removed in v1.8. Use" - " `Trainer.{fit,validate,test,predict}` instead." - ) - return self._run_stage() - def _run_stage(self): self.strategy.barrier("run-stage") self.strategy.dispatch(self) diff --git a/tests/tests_pytorch/deprecated_api/test_remove_1-8.py b/tests/tests_pytorch/deprecated_api/test_remove_1-8.py index aa25c1cdda..9104beb06e 100644 --- a/tests/tests_pytorch/deprecated_api/test_remove_1-8.py +++ b/tests/tests_pytorch/deprecated_api/test_remove_1-8.py @@ -65,13 +65,6 @@ def test_v1_8_0_deprecated_call_hook(): trainer.call_hook("test_hook") -def test_v1_8_0_deprecated_run_stage(): - trainer = Trainer() - trainer._run_stage = Mock() - with pytest.deprecated_call(match="`Trainer.run_stage` is deprecated in v1.6 and will be removed in v1.8."): - trainer.run_stage() - - def test_v1_8_0_trainer_verbose_evaluate(): trainer = Trainer() with pytest.deprecated_call(match="verbose_evaluate` property has been deprecated and will be removed in v1.8"):