Skip to content

Commit a45c047

Browse files
awaelchlicarmocca
andauthored
Remove deprecated LightningIPUModule (#14830)
* Remove deprecated LightningIPUModule * chlog * fix import * Fix 1.10 depr test Co-authored-by: Carlos Mocholí <[email protected]>
1 parent d377d0e commit a45c047

File tree

4 files changed

+4
-32
lines changed

4 files changed

+4
-32
lines changed

src/pytorch_lightning/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
222222
- Removed the deprecated device attributes `Trainer.{devices,gpus,num_gpus,ipus,tpu_cores}` in favor of the accelerator-agnostic `Trainer.num_devices` ([#14829](https://github.com/Lightning-AI/lightning/pull/14829))
223223

224224

225+
- Removed the deprecated `LightningIPUModule` ([#14830](https://github.com/Lightning-AI/lightning/pull/14830))
226+
227+
225228
- Removed the deprecated `Logger.agg_and_log_metrics` hook in favour of `Logger.log_metrics` and the `agg_key_funcs` and `agg_default_func` arguments. ([#14840](https://github.com/Lightning-AI/lightning/pull/14840))
226229

227230

src/pytorch_lightning/strategies/ipu.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from lightning_lite.plugins import CheckpointIO, ClusterEnvironment
2525
from lightning_lite.plugins.precision.utils import _fp_to_half
2626
from lightning_lite.utilities.cloud_io import get_filesystem
27-
from pytorch_lightning.overrides.base import _LightningModuleWrapperBase, _LightningPrecisionModuleWrapperBase
27+
from pytorch_lightning.overrides.base import _LightningModuleWrapperBase
2828
from pytorch_lightning.plugins.precision import PrecisionPlugin
2929
from pytorch_lightning.strategies.parallel import ParallelStrategy
3030
from pytorch_lightning.strategies.strategy import TBroadcast
@@ -33,7 +33,6 @@
3333
from pytorch_lightning.utilities.data import _get_dataloader_init_args_and_kwargs, _reinstantiate_wrapped_cls
3434
from pytorch_lightning.utilities.exceptions import MisconfigurationException
3535
from pytorch_lightning.utilities.model_helpers import is_overridden
36-
from pytorch_lightning.utilities.rank_zero import rank_zero_deprecation
3736
from pytorch_lightning.utilities.types import STEP_OUTPUT
3837

3938
if _POPTORCH_AVAILABLE:
@@ -42,28 +41,6 @@
4241
poptorch = None
4342

4443

45-
class LightningIPUModule(_LightningModuleWrapperBase):
46-
"""
47-
.. deprecated:: v1.7.0
48-
``LightningIPUModule`` has been deprecated in v1.7.0 and will be removed in v1.9.0.
49-
"""
50-
51-
def __init__(
52-
self,
53-
forward_module: Optional[Union["pl.LightningModule", _LightningPrecisionModuleWrapperBase]] = None,
54-
precision: Union[str, int] = 32,
55-
pl_module: Optional[Union["pl.LightningModule", _LightningPrecisionModuleWrapperBase]] = None,
56-
) -> None:
57-
rank_zero_deprecation("`LightningIPUModule` has been deprecated in v1.7.0 and will be removed in v1.8.0")
58-
self._validate_init_arguments(pl_module, forward_module)
59-
super().__init__(forward_module=(pl_module or forward_module))
60-
self.precision = precision
61-
62-
def forward(self, *inputs: Any, **kwargs: Any) -> Any:
63-
inputs = apply_to_collection(inputs, Tensor, function=_fp_to_half, precision=self.precision)
64-
return super().forward(*inputs, **kwargs)
65-
66-
6744
class IPUStrategy(ParallelStrategy):
6845
"""Plugin for training on IPU devices."""
6946

tests/tests_pytorch/deprecated_api/test_remove_1-10.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
from pytorch_lightning.plugins.environments import LightningEnvironment
3434
from pytorch_lightning.strategies.bagua import LightningBaguaModule
3535
from pytorch_lightning.strategies.deepspeed import LightningDeepSpeedModule
36-
from pytorch_lightning.strategies.ipu import LightningIPUModule
3736
from pytorch_lightning.strategies.utils import on_colab_kaggle
3837
from pytorch_lightning.utilities.apply_func import (
3938
apply_to_collection,
@@ -85,7 +84,6 @@ def test_deprecated_amp_level():
8584
LightningBaguaModule,
8685
LightningDeepSpeedModule,
8786
pytest.param(LightningShardedDataParallel, marks=RunIf(fairscale=True)),
88-
LightningIPUModule,
8987
],
9088
)
9189
def test_v1_10_deprecated_pl_module_init_parameter(wrapper_class):

tests/tests_pytorch/deprecated_api/test_remove_1-8.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from pytorch_lightning import Callback, Trainer
2121
from pytorch_lightning.callbacks import ModelCheckpoint
2222
from pytorch_lightning.demos.boring_classes import BoringDataModule, BoringModel
23-
from pytorch_lightning.strategies.ipu import LightningIPUModule
2423
from pytorch_lightning.trainer.configuration_validator import _check_datamodule_checkpoint_hooks
2524

2625

@@ -257,11 +256,6 @@ def on_load_checkpoint(self, checkpoint):
257256
_check_datamodule_checkpoint_hooks(trainer)
258257

259258

260-
def test_v1_8_0_deprecated_lightning_ipu_module():
261-
with pytest.deprecated_call(match=r"has been deprecated in v1.7.0 and will be removed in v1.8."):
262-
_ = LightningIPUModule(BoringModel(), 32)
263-
264-
265259
def test_deprecated_mc_save_checkpoint():
266260
mc = ModelCheckpoint()
267261
trainer = Trainer()

0 commit comments

Comments
 (0)