From 95accbb2e308c57ab732122718c35e84064145cc Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Fri, 1 Apr 2022 12:30:29 +0530 Subject: [PATCH 1/5] remove summarize() --- pytorch_lightning/core/lightning.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py index b5a748295a7ea..d3e756e2bfada 100644 --- a/pytorch_lightning/core/lightning.py +++ b/pytorch_lightning/core/lightning.py @@ -1706,28 +1706,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. From 29a265fd71f9d285db90f2f3979fa301244196be Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Fri, 1 Apr 2022 12:49:02 +0530 Subject: [PATCH 2/5] update --- pytorch_lightning/core/lightning.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py index d3e756e2bfada..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 From acb9387022c3869f3d9402e5284befaa8e686665 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Fri, 1 Apr 2022 13:28:43 +0530 Subject: [PATCH 3/5] remove deprecated test --- tests/deprecated_api/test_remove_1-7.py | 6 ------ 1 file changed, 6 deletions(-) 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"): From 0e8ffa9bd23eeaec87cd6544bcfe3e5a6ac79228 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Fri, 1 Apr 2022 14:22:01 +0530 Subject: [PATCH 4/5] update chlog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) 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)) From d6ee9bfcd19d0694992a607c779939c7a3ea4e89 Mon Sep 17 00:00:00 2001 From: rohitgr7 Date: Fri, 1 Apr 2022 18:15:39 +0530 Subject: [PATCH 5/5] update test --- tests/trainer/logging_/test_logger_connector.py | 1 - 1 file changed, 1 deletion(-) 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)