-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Deprecate DataModule properties: train_transforms, val_transforms, test_transforms, dims, and size #8851
Conversation
…tamodule methods: train_transforms, val_transforms, test_transforms, dums, and size
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #8851 +/- ##
=======================================
- Coverage 93% 89% -4%
=======================================
Files 169 169
Lines 14073 14090 +17
=======================================
- Hits 13045 12486 -559
- Misses 1028 1604 +576 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on this @Tshimanga !
- Please add deprecation warnings in the constructor as well, in case these arguments are not None: https://github.com/PyTorchLightning/pytorch-lightning/blob/cb2a8ed1b8f78386de4771d3bc59e19022e1b023/pytorch_lightning/core/datamodule.py#L71-L76
- Please add a test like this to ensure that the deprecation warnings appear: https://github.com/PyTorchLightning/pytorch-lightning/blob/cb2a8ed1b8f78386de4771d3bc59e19022e1b023/tests/deprecated_api/test_remove_1-6.py#L146-L165
…uctor for deprecated transforms, and added deprecation warning checks to v1.7 test
Hello @Tshimanga! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-08-11 03:15:21 UTC |
These are some occurrences found by grepping the project which should be addressed/updated/removed tests/helpers/boring_model.py:163: self.dims = self.random_train[0].shape
tests/helpers/boring_model.py:170: self.dims = getattr(self, "dims", self.random_test[0].shape)
tests/helpers/boring_model.py:174: self.dims = getattr(self, "dims", self.random_predict[0].shape)
tests/helpers/datamodules.py:43: # self.dims is returned when you call dm.size()
tests/helpers/datamodules.py:44: # Setting default dims here because we know them.
tests/helpers/datamodules.py:46: self.dims = (1, 28, 28)
docs/source/extensions/datamodules.rst:130: # self.dims is returned when you call dm.size()
docs/source/extensions/datamodules.rst:131: # Setting default dims here because we know them.
docs/source/extensions/datamodules.rst:133: self.dims = (1, 28, 28)
docs/source/extensions/datamodules.rst:148: # self.dims = tuple(self.mnist_train[0][0].shape)
docs/source/extensions/datamodules.rst:155: # self.dims = tuple(self.mnist_test[0][0].shape)
docs/source/extensions/datamodules.rst:224: self.dims = self.mnist_train[0][0].shape
docs/source/extensions/datamodules.rst:229: self.dims = getattr(self, "dims", self.mnist_test[0][0].shape)
pl_examples/basic_examples/mnist_datamodule.py:82: self.dims = (1, 28, 28)
pl_examples/domain_templates/generative_adversarial_net.py:230: self.dims = (1, 28, 28)
docs/source/extensions/datamodules.rst:366: def __init__(self, train_transforms, val_transforms, test_transforms):
docs/source/extensions/datamodules.rst:368: self.train_transforms = train_transforms
docs/source/extensions/datamodules.rst:369: self.val_transforms = val_transforms
docs/source/extensions/datamodules.rst:370: self.test_transforms = test_transforms
docs/source/starter/introduction_guide.rst:1121: train_transforms = ...
docs/source/starter/introduction_guide.rst:1122: val_transforms = ...
docs/source/starter/introduction_guide.rst:1123: test_transforms = ...
pl_examples/basic_examples/mnist_datamodule.py:91: self.test_transforms = self.default_transforms
pl_examples/basic_examples/mnist_datamodule.py:135: extra = dict(transform=self.test_transforms) if self.test_transforms else {} |
@carmocca so I didn't remove those occurrences because they seemed to be implementation details of those specific datamodules, and I don't believe determining what other datamodules may or may not implement their own additional properties is in scope of this ticket, just cleaning up the
That said, if the goal is actually to purge these properties from any classes implementing the |
By the way, thanks for the attentiveness guys! @carmocca @ananthsub Really appreciate the rapid feedback :) |
I don't think we need to purge these properties from all classes. If modules want to implement @Tshimanga you could go through the docs to ensure those references to ensure that no arguments are based to the base DataModule constructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
This is important as it's not nice to have the docs using deprecated functionality. |
@carmocca Good morning, and yeah definitely. I guess I'll open a follow up PR for that after work. Didn't realize this branch would be merged for me. 👍🏽 |
I was premature with the merge! My apologies @Tshimanga @carmocca . @Tshimanga a follow up PR would be hugely appreciated! |
…st_transforms, dims, and size (Lightning-AI#8851) * Deprecate DataModule properties: train_transforms, val_transforms, test_transforms, dims, and size
Deprecate DataModule properties: train_transforms, val_transforms, test_transforms, dums, and size
What does this PR do?
added deprecation warnings to Datamodule methods: train_transforms, val_transforms, test_transforms, dums, and size.
as per the approach outlined in the ticket based on #7301 where the deprecation warning goes out next release and then is removed two releases later. I did not find any tests that need to be moved.
Fixes #8728
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃