Skip to content

Commit 2ee187e

Browse files
authored
Remove the deprecated LightningModule.summarize (#12559)
1 parent 56a3485 commit 2ee187e

File tree

4 files changed

+3
-30
lines changed

4 files changed

+3
-30
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6060

6161
### Removed
6262

63+
- Removed the deprecated `summarize` method from the `LightningModule` ([#12559](https://github.com/PyTorchLightning/pytorch-lightning/pull/12559))
64+
65+
6366
- Removed the deprecated `stochastic_weight_avg` argument from the `Trainer` constructor ([#12535](https://github.com/PyTorchLightning/pytorch-lightning/pull/12535))
6467

6568

pytorch_lightning/core/lightning.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
from pytorch_lightning.utilities.distributed import distributed_available, sync_ddp
4747
from pytorch_lightning.utilities.exceptions import MisconfigurationException
4848
from pytorch_lightning.utilities.memory import get_model_size_mb
49-
from pytorch_lightning.utilities.model_summary import ModelSummary, summarize
5049
from pytorch_lightning.utilities.parsing import collect_init_args
5150
from pytorch_lightning.utilities.rank_zero import rank_zero_debug, rank_zero_deprecation, rank_zero_warn
5251
from pytorch_lightning.utilities.signature_utils import is_param_in_hook_signature
@@ -1706,28 +1705,6 @@ def tbptt_split_batch(self, batch, split_size):
17061705

17071706
return splits
17081707

1709-
def summarize(self, max_depth: int = 1) -> ModelSummary:
1710-
"""Summarize this LightningModule.
1711-
1712-
.. deprecated:: v1.5
1713-
This method was deprecated in v1.5 in favor of `pytorch_lightning.utilities.model_summary.summarize`
1714-
and will be removed in v1.7.
1715-
1716-
Args:
1717-
max_depth: The maximum depth of layer nesting that the summary will include. A value of 0 turns the
1718-
layer summary off. Default: 1.
1719-
1720-
Return:
1721-
The model summary object
1722-
"""
1723-
rank_zero_deprecation(
1724-
"The `LightningModule.summarize` method is deprecated in v1.5 and will be removed in v1.7. "
1725-
"Use `pytorch_lightning.utilities.model_summary.summarize` instead.",
1726-
stacklevel=6,
1727-
)
1728-
1729-
return summarize(self, max_depth)
1730-
17311708
def freeze(self) -> None:
17321709
r"""
17331710
Freeze all params for inference.

tests/deprecated_api/test_remove_1-7.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@
4545
from tests.plugins.environments.test_lsf_environment import _make_rankfile
4646

4747

48-
def test_v1_7_0_deprecated_lightning_module_summarize(tmpdir):
49-
model = BoringModel()
50-
with pytest.deprecated_call(match="The `LightningModule.summarize` method is deprecated in v1.5"):
51-
model.summarize(max_depth=1)
52-
53-
5448
def test_v1_7_0_moved_model_summary_and_layer_summary(tmpdir):
5549
_soft_unimport_module("pytorch_lightning.core.memory")
5650
with pytest.deprecated_call(match="to `pytorch_lightning.utilities.model_summary` since v1.5"):

tests/trainer/logging_/test_logger_connector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def test_fx_validator_integration(tmpdir):
246246
"on_save_checkpoint": "You can't",
247247
"on_load_checkpoint": "You can't",
248248
"on_exception": "You can't",
249-
"summarize": "not managed by the `Trainer",
250249
}
251250
model = HookedModel(not_supported)
252251

0 commit comments

Comments
 (0)