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

Make unimplemented dataloader hooks raise NotImplementedError #9161

Merged
merged 7 commits into from
Aug 28, 2021

Conversation

Tshimanga
Copy link
Contributor

@Tshimanga Tshimanga commented Aug 27, 2021

What does this PR do?

Fixes #8752

Does your PR introduce any breaking changes? If yes, please list them.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • 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?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

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:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun? yes

Make sure you had fun coding 🙃

@ananthsub I added the raise NotImplementedError on the other dataloader hooks, but I'm still curious about that choice if you have a moment

@ananthsub so the ticket states This applies for all the dataloader hooks in DataHooks, not just train_dataloader, but based on the docstrings on all the other dataloader hooks {val, test, predict}_dataloader are intentionally optional hooks whose presence is not necessary to run the Trainer. Is the assertion here that users will be required to override all of these dataloader hooks?

Copy link
Contributor

@ananthsub ananthsub left a 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 update the PR title to be more descriptive of the actual change

CHANGELOG.md Outdated Show resolved Hide resolved
tests/core/test_datamodules.py Show resolved Hide resolved
@ananthsub ananthsub added data handling Generic data-related topic refactor labels Aug 27, 2021
@ananthsub ananthsub added this to the v1.5 milestone Aug 27, 2021
@Tshimanga Tshimanga changed the title Feature/chore#8752 Make unimplemented dataloader hooks raise NotImplementedError Aug 27, 2021
@ananthsub
Copy link
Contributor

This applies for all the dataloader hooks in DataHooks, not just train_dataloader, but based on the docstrings on all the other dataloader hooks {val, test, predict}_dataloader are intentionally optional hooks whose presence is not necessary to run the Trainer. Is the assertion here that users will be required to override all of these dataloader hooks?

Technically, all of the hooks are optional to implement, depending on which Trainer function is called. For instance, if you call Trainer.validate the train dataloader is never checked or invoked. Additionally, the Trainer checks whether the corresponding dataloader hook is overridden before that loop's execution. However, if that override check fails for any reason, this will let us know sooner.

@codecov
Copy link

codecov bot commented Aug 27, 2021

Codecov Report

Merging #9161 (95b8a9c) into master (0dfc6a1) will decrease coverage by 4%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #9161    +/-   ##
=======================================
- Coverage      92%     88%    -4%     
=======================================
  Files         176     176            
  Lines       14857   14858     +1     
=======================================
- Hits        13703   13085   -618     
- Misses       1154    1773   +619     

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@mergify mergify bot added the ready PRs ready to be merged label Aug 27, 2021
@carmocca carmocca enabled auto-merge (squash) August 27, 2021 12:42
@Tshimanga
Copy link
Contributor Author

Tshimanga commented Aug 27, 2021

@ananthsub @tchaton @awaelchli @carmocca
It looks like the required test PL.pytorch-lightning (GPUs) is hanging on pl_examples/test_examples.py::test_examples_cpu, but there isn't an error indicated. It just fails to progress and gets cancelled. I've looked at the test and I think I lack familiarity to pick out how/if my changes might have caused this. Some assistance would be appreciated 🙏🏽

https://dev.azure.com/PytorchLightning/pytorch-lightning/_build/results?buildId=27719&view=logs&j=48e2c176-e5bf-5c04-26fb-02608a8a8927&t=fba91523-81e0-5703-785d-4a83eb9c4946&l=26

@awaelchli
Copy link
Contributor

it's not from your PR, pretty sure
related #9021

@Tshimanga
Copy link
Contributor Author

@awaelchli hmm, looks like another failure. maybe #9021 just needs to be merged first?

@Tshimanga
Copy link
Contributor Author

@awaelchli hmm it looks like generally those tests do creep pretty close to the 45min upper limit though
image

@Tshimanga Tshimanga mentioned this pull request Aug 28, 2021
12 tasks
@carmocca carmocca merged commit c993d0c into Lightning-AI:master Aug 28, 2021
daavoo added a commit to iterative/dvclive that referenced this pull request Nov 3, 2021
Latest version (v1.5.0) requires to override all dataloader methods: Lightning-AI/pytorch-lightning#9161 making pylint raise error in our test

Close #186
daavoo added a commit to iterative/dvclive that referenced this pull request Nov 3, 2021
Latest version (v1.5.0) requires to override all dataloader methods: Lightning-AI/pytorch-lightning#9161 making pylint raise error in our test

Close #186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data handling Generic data-related topic ready PRs ready to be merged refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make default implementation for train_dataloader in DataHooks raise NotImplementedError
6 participants