Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e11c16d
Move LightningModule.summarize() off of LightningModule to utilities
samlurye Jul 21, 2021
2d1ce57
Update CHANGELOG.md with changes from e11c16da
samlurye Jul 21, 2021
0fb5753
Merge branch 'master' of https://github.com/PyTorchLightning/pytorch-…
samlurye Jul 21, 2021
c695078
Merge pull request #2 from samlurye/PyTorchLightning-master
samlurye Jul 21, 2021
e43daac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 21, 2021
1befd4a
Fix some code check and testing issues
samlurye Jul 21, 2021
26588df
Merge pull request #3 from samlurye/PyTorchLightning-master
samlurye Jul 21, 2021
3686b05
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 21, 2021
0d8ea7d
Update tests/utilities/test_model_summary.py
samlurye Jul 21, 2021
da8cd59
Update tests/utilities/test_model_summary.py
samlurye Jul 21, 2021
4194ca9
Update pytorch_lightning/core/lightning.py
samlurye Jul 21, 2021
0ba1573
Add backward compatibility for LayerSummary and ModelSummary
samlurye Jul 21, 2021
eb3ed28
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 21, 2021
3e93e2c
Move all functions out of core/memory.py
samlurye Jul 22, 2021
3cce6e0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 22, 2021
caca34f
Remove unused import logging from model_summary.py
samlurye Jul 22, 2021
793160d
Merge branch 'master' of https://github.com/samlurye/pytorch-lightning
samlurye Jul 22, 2021
48e81d3
Update tests/accelerators/test_ddp_spawn.py
ananthsub Jul 27, 2021
eba7c9e
Merge branch 'master' into contrib/deprecate-summary
awaelchli Jul 27, 2021
5a0c407
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2021
9e5b8b9
add import for the typehint in summarize()
awaelchli Jul 27, 2021
783072c
fix unused imports
awaelchli Jul 27, 2021
c4ecf54
Merge branch 'PyTorchLightning:master' into master
samlurye Jul 28, 2021
0c3cdc8
Fix typo in test_ddp_spawn.py
samlurye Jul 30, 2021
dd34e73
Merge branch 'master' of https://github.com/samlurye/pytorch-lightning
samlurye Jul 30, 2021
85870d6
Add back log.info call
samlurye Jul 30, 2021
ea27e98
Update pytorch_lightning/core/memory.py
samlurye Jul 30, 2021
432c6e1
Update pytorch_lightning/core/memory.py
samlurye Jul 30, 2021
c1b55a8
Merge branch 'master' into master
samlurye Jul 30, 2021
b7f47b8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 30, 2021
9dc913a
fix ticks in warning message test
awaelchli Aug 3, 2021
2dbffab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2021
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Deprecated

- Deprecated `LightningModule.summarize()` in favor of `pytorch_lightning.utilities.model_summary.summarize()`


- Deprecated `LightningModule.model_size` ([#8343](https://github.com/PyTorchLightning/pytorch-lightning/pull/8343))


Expand Down
29 changes: 11 additions & 18 deletions pytorch_lightning/core/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

from pytorch_lightning.core.grads import GradInformation
from pytorch_lightning.core.hooks import CheckpointHooks, DataHooks, ModelHooks
from pytorch_lightning.core.memory import ModelSummary
from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin, HyperparametersMixin
from pytorch_lightning.core.optimizer import LightningOptimizer
from pytorch_lightning.core.saving import ModelIO
Expand All @@ -44,6 +43,7 @@
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.signature_utils import is_param_in_hook_signature
from pytorch_lightning.utilities.types import _METRIC_COLLECTION, EPOCH_OUTPUT, STEP_OUTPUT
Expand Down Expand Up @@ -1707,6 +1707,10 @@ def summarize(self, mode: Optional[str] = "top", max_depth: Optional[int] = None
"""
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:
mode: Can be either ``'top'`` (summarize only direct submodules) or ``'full'`` (summarize all layers).

Expand All @@ -1719,24 +1723,13 @@ def summarize(self, mode: Optional[str] = "top", max_depth: Optional[int] = None
Return:
The model summary object
"""
model_summary = None

# temporary mapping from mode to max_depth
if max_depth is None:
if mode in ModelSummary.MODES:
max_depth = ModelSummary.MODES[mode]
rank_zero_deprecation(
f"Argument `mode` in `LightningModule.summarize` is deprecated in v1.4"
f" and will be removed in v1.6. Use `max_depth={max_depth}` to replicate `mode={mode}` behavior."
)
model_summary = ModelSummary(self, max_depth=max_depth)
elif mode is not None:
raise MisconfigurationException(f"`mode` can be None, {', '.join(ModelSummary.MODES)}, got {mode}")
else:
model_summary = ModelSummary(self, max_depth=max_depth)
warning_cache.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,
)

log.info("\n" + str(model_summary))
return model_summary
return summarize(self, mode, max_depth)

def freeze(self) -> None:
r"""
Expand Down
Loading