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.val_transforms #12763

Merged
merged 8 commits into from
Apr 22, 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 @@ -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 `val_transforms` argument from the `LightningDataModule` constructor ([#12763](https://github.com/PyTorchLightning/pytorch-lightning/pull/12763))


- Removed the deprecated `test_transforms` argument from the `LightningDataModule` constructor ([#12773](https://github.com/PyTorchLightning/pytorch-lightning/pull/12773))


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,35 +54,11 @@ def teardown(self):

name: str = ...

def __init__(self, val_transforms=None):
def __init__(self) -> 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."
)
self._val_transforms = val_transforms
# Pointer to the trainer object
self.trainer = None

@property
def val_transforms(self):
"""Optional transforms (or collection of transforms) you can apply to validation dataset.

.. deprecated:: v1.5 Will be removed in v1.7.0.
"""

rank_zero_deprecation(
"DataModule property `val_transforms` was deprecated in v1.5 and will be removed in v1.7."
)
return self._val_transforms

@val_transforms.setter
def val_transforms(self, t):
rank_zero_deprecation(
"DataModule property `val_transforms` was deprecated in v1.5 and will be removed in v1.7."
)
self._val_transforms = t

@classmethod
def add_argparse_args(cls, parent_parser: ArgumentParser, **kwargs) -> ArgumentParser:
"""Extends existing argparse by default `LightningDataModule` attributes."""
Expand Down
8 changes: 0 additions & 8 deletions tests/deprecated_api/test_remove_1-7.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@
from tests.plugins.environments.test_lsf_environment import _make_rankfile


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 `val_transforms` was deprecated in v1.5"):
_ = LightningDataModule(val_transforms="b")


def test_v1_7_0_moved_get_progress_bar_dict(tmpdir):
class TestModel(BoringModel):
def get_progress_bar_dict(self):
Expand Down