Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the deprecated LightningDataModule.test_transforms #12773

Merged
merged 8 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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 @@ -118,6 +118,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))


### Fixed

- Run main progress bar updates independent of val progress bar updates in `TQDMProgressBar` ([#12563](https://github.com/PyTorchLightning/pytorch-lightning/pull/12563))
Expand Down
26 changes: 1 addition & 25 deletions pytorch_lightning/core/datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,15 @@ def teardown(self):

name: str = ...

def __init__(self, val_transforms=None, test_transforms=None, dims=None):
def __init__(self, val_transforms=None, dims=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."
)
if dims is not None:
rank_zero_deprecation("DataModule property `dims` was deprecated in v1.5 and will be removed in v1.7.")
self._val_transforms = val_transforms
self._test_transforms = test_transforms
self._dims = dims if dims is not None else ()

# Pointer to the trainer object
Expand All @@ -92,25 +87,6 @@ def val_transforms(self, t):
)
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

@property
def dims(self):
"""A tuple describing the shape of your data. Extra functionality exposed in ``size``.
Expand Down
6 changes: 0 additions & 6 deletions tests/deprecated_api/test_remove_1-7.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +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")
with pytest.deprecated_call(match=r"DataModule property `test_transforms` was deprecated in v1.5"):
_ = LightningDataModule(test_transforms="c", dims=(1, 1, 1))


def test_v1_7_0_datamodule_size_property(tmpdir):
Expand Down