Skip to content

Removed deprecated trainer_lightning_optimizers #14889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Remove the deprecated `Trainer.should_rank_save_checkpoint` ([#14885](https://github.com/Lightning-AI/lightning/pull/14885))

- Removed the deprecated `Trainer.lightning_optimizers` ([#14889](https://github.com/Lightning-AI/lightning/pull/14889))


### Fixed

Expand Down
8 changes: 0 additions & 8 deletions src/pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
from pytorch_lightning.callbacks import Callback, Checkpoint, EarlyStopping, ProgressBarBase
from pytorch_lightning.callbacks.prediction_writer import BasePredictionWriter
from pytorch_lightning.core.datamodule import LightningDataModule
from pytorch_lightning.core.optimizer import LightningOptimizer
from pytorch_lightning.loggers import Logger
from pytorch_lightning.loggers.tensorboard import TensorBoardLogger
from pytorch_lightning.loops import PredictionLoop, TrainingEpochLoop
Expand Down Expand Up @@ -1786,13 +1785,6 @@ def optimizers(self) -> List[Optimizer]:
def optimizers(self, new_optims: Optional[List[Optimizer]]) -> None:
self.strategy.optimizers = new_optims

@property
def lightning_optimizers(self) -> Dict[int, LightningOptimizer]:
rank_zero_deprecation(
"`Trainer.lightning_optimizers` is deprecated in v1.6 and will be removed in v1.8", stacklevel=5
)
return self.strategy._lightning_optimizers

@property
def lr_scheduler_configs(self) -> List[LRSchedulerConfig]:
return self.strategy.lr_scheduler_configs
Expand Down
8 changes: 0 additions & 8 deletions tests/tests_pytorch/deprecated_api/test_remove_1-8.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ def test_v_1_8_0_deprecated_device_stats_monitor_prefix_metric_keys():
prefix_metric_keys({"foo": 1.0}, "bar")


def test_v1_8_0_deprecated_lightning_optimizers():
trainer = Trainer()
with pytest.deprecated_call(
match="Trainer.lightning_optimizers` is deprecated in v1.6 and will be removed in v1.8"
):
assert trainer.lightning_optimizers == {}


def test_v1_8_0_remove_on_batch_start_end(tmpdir):
class TestCallback(Callback):
def on_batch_start(self, *args, **kwargs):
Expand Down