Skip to content
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

Removed the deprecated the trainer.lr_schedulers #14408

Merged
merged 6 commits into from
Aug 28, 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
3 changes: 3 additions & 0 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed the experimental `pytorch_lightning.utiltiies.meta` functions in favor of built-in https://github.com/pytorch/torchdistx support ([#13868](https://github.com/Lightning-AI/lightning/pull/13868))


- Removed the deprecated the `trainer.lr_schedulers` ([#14408](https://github.com/Lightning-AI/lightning/pull/14408))


- Removed the deprecated `LightningModule.{on_hpc_load,on_hpc_save}` hooks in favor of the general purpose hooks `LightningModule.{on_load_checkpoint,on_save_checkpoint}` ([#14315](https://github.com/Lightning-AI/lightning/pull/14315))


Expand Down
11 changes: 0 additions & 11 deletions src/pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,17 +2138,6 @@ def lightning_optimizers(self) -> Dict[int, LightningOptimizer]:
def lr_scheduler_configs(self) -> List[LRSchedulerConfig]:
return self.strategy.lr_scheduler_configs

@property
def lr_schedulers(self) -> List[Dict[str, Any]]:
rank_zero_deprecation(
"`Trainer.lr_schedulers` is deprecated in v1.6 and will be removed in v1.8."
" You can use `trainer.lr_scheduler_configs` instead which contains dataclasses instead of dictionaries.",
stacklevel=5,
)
from dataclasses import asdict

return [asdict(config) for config in self.strategy.lr_scheduler_configs]

@property
def optimizer_frequencies(self) -> List[int]:
return self.strategy.optimizer_frequencies
Expand Down
6 changes: 0 additions & 6 deletions tests/tests_pytorch/deprecated_api/test_remove_1-8.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ def test_v1_8_0_deprecated_trainer_should_rank_save_checkpoint(tmpdir):
_ = trainer.should_rank_save_checkpoint


def test_v1_8_0_deprecated_lr_scheduler():
trainer = Trainer()
with pytest.deprecated_call(match=r"`Trainer.lr_schedulers` is deprecated in v1.6 and will be removed in v1.8."):
assert trainer.lr_schedulers == []


def test_v1_8_0_trainer_optimizers_mixin():
trainer = Trainer()
model = BoringModel()
Expand Down