diff --git a/CHANGELOG.md b/CHANGELOG.md index 006d3e33862a9..0db9e69d28180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Removed +- Removed the deprecated `summarize` method from the `LightningModule` ([#12559](https://github.com/PyTorchLightning/pytorch-lightning/pull/12559)) + + - Removed the deprecated `stochastic_weight_avg` argument from the `Trainer` constructor ([#12535](https://github.com/PyTorchLightning/pytorch-lightning/pull/12535)) diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py index b5a748295a7ea..ef162374318d1 100644 --- a/pytorch_lightning/core/lightning.py +++ b/pytorch_lightning/core/lightning.py @@ -46,7 +46,6 @@ from pytorch_lightning.utilities.distributed import distributed_available, sync_ddp from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.memory import get_model_size_mb -from pytorch_lightning.utilities.model_summary import ModelSummary, summarize from pytorch_lightning.utilities.parsing import collect_init_args from pytorch_lightning.utilities.rank_zero import rank_zero_debug, rank_zero_deprecation, rank_zero_warn from pytorch_lightning.utilities.signature_utils import is_param_in_hook_signature @@ -1706,28 +1705,6 @@ def tbptt_split_batch(self, batch, split_size): return splits - def summarize(self, max_depth: int = 1) -> ModelSummary: - """Summarize this LightningModule. - - .. deprecated:: v1.5 - This method was deprecated in v1.5 in favor of `pytorch_lightning.utilities.model_summary.summarize` - and will be removed in v1.7. - - Args: - max_depth: The maximum depth of layer nesting that the summary will include. A value of 0 turns the - layer summary off. Default: 1. - - Return: - The model summary object - """ - rank_zero_deprecation( - "The `LightningModule.summarize` method is deprecated in v1.5 and will be removed in v1.7. " - "Use `pytorch_lightning.utilities.model_summary.summarize` instead.", - stacklevel=6, - ) - - return summarize(self, max_depth) - def freeze(self) -> None: r""" Freeze all params for inference. diff --git a/tests/deprecated_api/test_remove_1-7.py b/tests/deprecated_api/test_remove_1-7.py index ecd890e6b6291..51cee5eaeab9a 100644 --- a/tests/deprecated_api/test_remove_1-7.py +++ b/tests/deprecated_api/test_remove_1-7.py @@ -45,12 +45,6 @@ from tests.plugins.environments.test_lsf_environment import _make_rankfile -def test_v1_7_0_deprecated_lightning_module_summarize(tmpdir): - model = BoringModel() - with pytest.deprecated_call(match="The `LightningModule.summarize` method is deprecated in v1.5"): - model.summarize(max_depth=1) - - def test_v1_7_0_moved_model_summary_and_layer_summary(tmpdir): _soft_unimport_module("pytorch_lightning.core.memory") with pytest.deprecated_call(match="to `pytorch_lightning.utilities.model_summary` since v1.5"): diff --git a/tests/trainer/logging_/test_logger_connector.py b/tests/trainer/logging_/test_logger_connector.py index 986f2ec982b8d..bd8fe86141282 100644 --- a/tests/trainer/logging_/test_logger_connector.py +++ b/tests/trainer/logging_/test_logger_connector.py @@ -246,7 +246,6 @@ def test_fx_validator_integration(tmpdir): "on_save_checkpoint": "You can't", "on_load_checkpoint": "You can't", "on_exception": "You can't", - "summarize": "not managed by the `Trainer", } model = HookedModel(not_supported)