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

Ref: Pull duplicate data interface definition up into DataHooks class #3344

Merged
merged 3 commits into from
Sep 4, 2020

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Sep 3, 2020

What does this PR do?

Fixes #2707

The PyTorch Lightning codebase must maintain a high quality. Code duplication is a source of bugs, hard to maintain and challenges the sanity of all developers involved.

By pulling the data related hooks up into a common super class / interface, we can maintain the documentation and specification in one place while implementing specific behaviour in subclasses. For example, the datamodule defines the dataloader methods as abstract, while the LightningModule does not. We can override the methods in the DataModule base class and decorate them as abstract, while still inheriting the docstring from the super class.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

@codecov
Copy link

codecov bot commented Sep 4, 2020

Codecov Report

Merging #3344 into master will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #3344   +/-   ##
======================================
  Coverage      90%     90%           
======================================
  Files          91      91           
  Lines        8157    8155    -2     
======================================
  Hits         7366    7366           
+ Misses        791     789    -2     

@awaelchli awaelchli marked this pull request as ready for review September 4, 2020 00:47
@mergify mergify bot requested a review from a team September 4, 2020 00:47
@mergify mergify bot requested a review from a team September 4, 2020 02:05
@mergify mergify bot requested a review from a team September 4, 2020 09:03
@williamFalcon williamFalcon merged commit 7bd2f94 into master Sep 4, 2020
@Borda Borda deleted the refactor/datamodule-sanity branch September 4, 2020 10:11
@Borda Borda added this to the 0.9.x milestone Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Design of DataModule
5 participants