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

[bugfix] Add support for CombinedLoader in validation with ddp #7102

Merged
merged 5 commits into from
Apr 20, 2021

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Apr 19, 2021

What does this PR do?

This PR add support resolve a bug with CombinedLoader and DDP.

Fixes #7013

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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
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?

Make sure you had fun coding 🙃

@tchaton tchaton added the distributed Generic distributed-related topic label Apr 19, 2021
@tchaton tchaton added this to the v1.3 milestone Apr 19, 2021
@tchaton tchaton self-assigned this Apr 19, 2021
@pep8speaks
Copy link

pep8speaks commented Apr 19, 2021

Hello @tchaton! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-04-20 07:52:39 UTC

@codecov
Copy link

codecov bot commented Apr 19, 2021

Codecov Report

Merging #7102 (a83fee2) into master (d12c6cf) will decrease coverage by 5%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #7102    +/-   ##
=======================================
- Coverage      92%     87%    -5%     
=======================================
  Files         197     197            
  Lines       12634   12686    +52     
=======================================
- Hits        11649   11039   -610     
- Misses        985    1647   +662     

@tchaton tchaton marked this pull request as ready for review April 19, 2021 16:50
@Borda Borda added the bug Something isn't working label Apr 19, 2021
@Borda Borda enabled auto-merge (squash) April 19, 2021 19:40
@Borda Borda added the ready PRs ready to be merged label Apr 19, 2021
Comment on lines 271 to 273
def validation_step(self, batch, batch_idx):
v = batch['a']
assert (v + int(self.trainer.global_rank == 1)) % 2 == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why we are testing the DistributedSampler in a full special test.
Would a simpler test do it? We have similar tests in tests/trainer/test_dataloaders

dataloader = CombinedLoader()
trainer = Trainer()
dataloader = trainer.auto_add_sampler(dataloader)
assert all(isinstance(loader.sampler, DistributedSampler) for loader in dataloader.loaders))

Copy link
Contributor Author

@tchaton tchaton Apr 20, 2021

Choose a reason for hiding this comment

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

Great comment ! You are definitely right ! Let me update the test.

@Borda Borda merged commit 9beec26 into master Apr 20, 2021
@Borda Borda deleted the combined_loader_validation branch April 20, 2021 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working distributed Generic distributed-related topic ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CombinedLoader changes sampling in DDP
5 participants