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

Fix overfit_batches > 0 on distributed_backend = "ddp" #3534

Merged
merged 9 commits into from
Sep 19, 2020

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Sep 17, 2020

What does this PR do?

Fixes #2311
Continuation of #3501

This bug is only present in ddp, it only applies to the case when we replace the distributed sampler

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? No. ddp_spawn case is covered, but ddp cannot be tested in CI :(
  • 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?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@pep8speaks
Copy link

pep8speaks commented Sep 17, 2020

Hello @awaelchli! Thanks for updating this PR.

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

Comment last updated at 2020-09-19 12:01:51 UTC

@awaelchli awaelchli added the bug Something isn't working label Sep 17, 2020
@awaelchli awaelchli marked this pull request as ready for review September 17, 2020 23:09
@mergify mergify bot requested a review from a team September 17, 2020 23:09
@@ -155,7 +155,7 @@ def _get_distributed_sampler(self, dataloader, train):
assert self.distributed_backend is not None
kwargs = dict(num_replicas=world_size[self.distributed_backend], rank=self.global_rank)

kwargs['shuffle'] = train
kwargs['shuffle'] = train and not self.overfit_batches
Copy link
Member

Choose a reason for hiding this comment

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

should we have a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SkafteNicki I tried to find a way but the problem is that this bug affects only ddp, and don't know how to test this due to the multiprocessing.

@mergify mergify bot requested a review from a team September 18, 2020 09:46
@mergify
Copy link
Contributor

mergify bot commented Sep 18, 2020

This pull request is now in conflict... :(

@awaelchli awaelchli changed the title Fix overfit_batches > 0 on distributed_backend = "ddp" [wip] Fix overfit_batches > 0 on distributed_backend = "ddp" Sep 19, 2020
@awaelchli awaelchli force-pushed the bugfix/overfit_batches branch 2 times, most recently from 2093e52 to 9335769 Compare September 19, 2020 11:59
@codecov
Copy link

codecov bot commented Sep 19, 2020

Codecov Report

Merging #3534 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #3534   +/-   ##
======================================
  Coverage      91%     91%           
======================================
  Files         109     109           
  Lines        8080    8080           
======================================
  Hits         7340    7340           
  Misses        740     740           

@awaelchli awaelchli changed the title [wip] Fix overfit_batches > 0 on distributed_backend = "ddp" Fix overfit_batches > 0 on distributed_backend = "ddp" Sep 19, 2020
Copy link
Member

@SkafteNicki SkafteNicki 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 requested a review from a team September 19, 2020 14:50
@williamFalcon williamFalcon merged commit e6c7548 into master Sep 19, 2020
ananthsub pushed a commit to ananthsub/pytorch-lightning that referenced this pull request Sep 20, 2020
…3534)

* example

* ex

* example

* sampler

* fix

* fix

* remove example

* changelog
@Borda Borda deleted the bugfix/overfit_batches branch September 20, 2020 08:38
@Borda Borda added this to the 0.9.x milestone Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overfit_batches doesn't work
5 participants