Automatically check DataModule.has_{setup,teardown,prepare_data} [2/2]#7238
Merged
Automatically check DataModule.has_{setup,teardown,prepare_data} [2/2]#7238
DataModule.has_{setup,teardown,prepare_data} [2/2]#7238Conversation
Codecov Report
@@ Coverage Diff @@
## master #7238 +/- ##
======================================
- Coverage 92% 92% -0%
======================================
Files 199 199
Lines 13030 13034 +4
======================================
- Hits 11967 11955 -12
- Misses 1063 1079 +16 |
DataModule.has_{setup,teardown,prepare_data}DataModule.has_{setup,teardown,prepare_data}
9 tasks
DataModule.has_{setup,teardown,prepare_data}DataModule.has_{setup,teardown,prepare_data}
DataModule.has_{setup,teardown,prepare_data}DataModule.has_{setup,teardown,prepare_data}
DataModule.has_{setup,teardown,prepare_data}DataModule.has_{setup,teardown,prepare_data} [2/2]
DataModule.has_{setup,teardown,prepare_data} [2/2]DataModule.has_{setup,teardown,prepare_data} [2/2]
carmocca
commented
May 4, 2021
ananthsub
approved these changes
May 4, 2021
Contributor
ananthsub
left a comment
There was a problem hiding this comment.
Agreed with the fix for now but I'm in favor of simplifying/deprecating these properties in v1.4
awaelchli
approved these changes
May 7, 2021
tchaton
approved these changes
May 10, 2021
Contributor
tchaton
left a comment
There was a problem hiding this comment.
LGTM ! @ananthsub I think this is an important feature as preparing a dataset can be costly and shouldn't be done several times.
How do you propose to solve this problem if we remove those properties ?
Borda
approved these changes
May 11, 2021
27 tasks
Closed
edgarriba
pushed a commit
that referenced
this pull request
May 18, 2021
…/2] (#7238) * Automatically check `DataModule.has_{setup,teardown,prepare_data}` * Use variable * Spacing * Docs * Update CHANGELOG * Remove `_DataModuleWrapper` * Add test * Update docs/source/extensions/datamodules.rst * Bad merge * add test for invalid name * Remove ValueError Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
lexierule
pushed a commit
that referenced
this pull request
May 19, 2021
…/2] (#7238) * Automatically check `DataModule.has_{setup,teardown,prepare_data}` * Use variable * Spacing * Docs * Update CHANGELOG * Remove `_DataModuleWrapper` * Add test * Update docs/source/extensions/datamodules.rst * Bad merge * add test for invalid name * Remove ValueError Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR automates checking whether the appropriate setup/teardown/prepare_data has been called. The check was only performed by the
Trainer. Now it is done by theDataModuleitself.This has implications for the users if they were manually calling these functions themselves, as they will now be a no-op if they had been called already.
Fixes:
Fixes the check when the stage is
None. Before it wasn't checking each attribute (has_setup_{fit,validate,test}) buthas_setup_Nonewhich is not defined.This PR does NOT fix_ #7286 because to properly resolve it, we need to avoid
stagebecomingNonein the first place.Note
The changes in this PR are the opposite of those discussed in #7301.
This PR attempts to fix the current design implementation. Not saying we should not change the design itself in the future.
Before submitting
PR review