diff --git a/CHANGELOG.md b/CHANGELOG.md index 400fe58b4eaee..a4a66f1157ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Removed the deprecated `summarize` method from the `LightningModule` ([#12559](https://github.com/PyTorchLightning/pytorch-lightning/pull/12559)) +- Removed the deprecated `model_size` property from the `LightningModule` class ([#12641](https://github.com/PyTorchLightning/pytorch-lightning/pull/12641)) + + - Removed the deprecated `stochastic_weight_avg` argument from the `Trainer` constructor ([#12535](https://github.com/PyTorchLightning/pytorch-lightning/pull/12535)) diff --git a/docs/source/common/lightning_module.rst b/docs/source/common/lightning_module.rst index fd9de11f601d8..9b94417abdc95 100644 --- a/docs/source/common/lightning_module.rst +++ b/docs/source/common/lightning_module.rst @@ -1112,11 +1112,6 @@ Set and access example_input_array, which basically represents a single batch. # generate some images using the example_input_array gen_images = self.generator(self.example_input_array) -model_size -~~~~~~~~~~ - -Get the model file size (in megabytes) using ``self.model_size`` inside LightningModule. - truncated_bptt_steps ~~~~~~~~~~~~~~~~~~~~ diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py index ef162374318d1..93d2a7d6f8999 100644 --- a/pytorch_lightning/core/lightning.py +++ b/pytorch_lightning/core/lightning.py @@ -45,7 +45,6 @@ from pytorch_lightning.utilities.cloud_io import get_filesystem 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.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 @@ -77,7 +76,6 @@ class LightningModule( "local_rank", "logger", "loggers", - "model_size", "automatic_optimization", "truncated_bptt_steps", "use_amp", @@ -1928,21 +1926,6 @@ def to_torchscript( return torchscript_module - @property - def model_size(self) -> float: - """Returns the model size in MegaBytes (MB) - - Note: - This property will not return correct value for Deepspeed (stage 3) and fully-sharded training. - """ - if not self._running_torchscript: # remove with the deprecation removal - rank_zero_deprecation( - "The `LightningModule.model_size` property was deprecated in v1.5 and will be removed in v1.7." - " Please use the `pytorch_lightning.utilities.memory.get_model_size_mb`.", - stacklevel=5, - ) - return get_model_size_mb(self) - @property def use_amp(self) -> bool: r""" diff --git a/tests/deprecated_api/test_remove_1-7.py b/tests/deprecated_api/test_remove_1-7.py index 167b3095d91b0..7525054f14452 100644 --- a/tests/deprecated_api/test_remove_1-7.py +++ b/tests/deprecated_api/test_remove_1-7.py @@ -57,14 +57,6 @@ def test_v1_7_0_moved_get_memory_profile_and_get_gpu_memory_map(tmpdir): from pytorch_lightning.core.memory import get_gpu_memory_map, get_memory_profile # noqa: F401 -def test_v1_7_0_deprecated_model_size(): - model = BoringModel() - with pytest.deprecated_call( - match="LightningModule.model_size` property was deprecated in v1.5 and will be removed in v1.7" - ): - _ = model.model_size - - def test_v1_7_0_datamodule_transform_properties(tmpdir): dm = MNISTDataModule() with pytest.deprecated_call(match=r"DataModule property `train_transforms` was deprecated in v1.5"):