Remove the deprecated `LightningDataModule.test_transforms` (#12773)

Co-authored-by: Raymond G Schireman <raymond.schireman@uvm.edu>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
This commit is contained in:
Ray Schireman 2022-04-21 12:40:15 -04:00 committed by GitHub
parent c482ae340a
commit 54a2b5ceeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 30 deletions

View File

@ -121,6 +121,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed support for passing strategy names or strategy instances to the plugins Trainer argument ([#12700](https://github.com/PyTorchLightning/pytorch-lightning/pull/12700))
- Removed the deprecated `test_transforms` argument from the `LightningDataModule` constructor ([#12773](https://github.com/PyTorchLightning/pytorch-lightning/pull/12773))
- Removed deprecated `dataloader_idx` argument from `on_train_batch_start/end` hooks `Callback` and `LightningModule` ([#12769](https://github.com/PyTorchLightning/pytorch-lightning/pull/12769))
### Fixed

View File

@ -54,19 +54,13 @@ class LightningDataModule(CheckpointHooks, DataHooks, HyperparametersMixin):
name: str = ...
def __init__(self, val_transforms=None, test_transforms=None):
def __init__(self, val_transforms=None):
super().__init__()
if val_transforms is not None:
rank_zero_deprecation(
"DataModule property `val_transforms` was deprecated in v1.5 and will be removed in v1.7."
)
if test_transforms is not None:
rank_zero_deprecation(
"DataModule property `test_transforms` was deprecated in v1.5 and will be removed in v1.7."
)
self._val_transforms = val_transforms
self._test_transforms = test_transforms
# Pointer to the trainer object
self.trainer = None
@ -89,25 +83,6 @@ class LightningDataModule(CheckpointHooks, DataHooks, HyperparametersMixin):
)
self._val_transforms = t
@property
def test_transforms(self):
"""Optional transforms (or collection of transforms) you can apply to test dataset.
.. deprecated:: v1.5 Will be removed in v1.7.0.
"""
rank_zero_deprecation(
"DataModule property `test_transforms` was deprecated in v1.5 and will be removed in v1.7."
)
return self._test_transforms
@test_transforms.setter
def test_transforms(self, t):
rank_zero_deprecation(
"DataModule property `test_transforms` was deprecated in v1.5 and will be removed in v1.7."
)
self._test_transforms = t
@classmethod
def add_argparse_args(cls, parent_parser: ArgumentParser, **kwargs) -> ArgumentParser:
"""Extends existing argparse by default `LightningDataModule` attributes."""

View File

@ -43,12 +43,8 @@ def test_v1_7_0_datamodule_transform_properties(tmpdir):
dm = MNISTDataModule()
with pytest.deprecated_call(match=r"DataModule property `val_transforms` was deprecated in v1.5"):
dm.val_transforms = "b"
with pytest.deprecated_call(match=r"DataModule property `test_transforms` was deprecated in v1.5"):
dm.test_transforms = "c"
with pytest.deprecated_call(match=r"DataModule property `val_transforms` was deprecated in v1.5"):
_ = LightningDataModule(val_transforms="b")
with pytest.deprecated_call(match=r"DataModule property `test_transforms` was deprecated in v1.5"):
_ = LightningDataModule(test_transforms="c")
def test_v1_7_0_moved_get_progress_bar_dict(tmpdir):