-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Replace DataLoader sampler once for IPUs #8858
Merged
Merged
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## master #8858 +/- ##
=======================================
Coverage 93% 93%
=======================================
Files 172 172
Lines 14114 14234 +120
=======================================
+ Hits 13091 13234 +143
+ Misses 1023 1000 -23 |
We don't have special tests, and only one IPU machine is available which is too slow for the full test suite CPU wise
carmocca
commented
Aug 14, 2021
carmocca
commented
Aug 14, 2021
awaelchli
approved these changes
Aug 16, 2021
kragniz
approved these changes
Aug 16, 2021
SeanNaren
approved these changes
Aug 16, 2021
tchaton
approved these changes
Aug 16, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
four4fish
pushed a commit
to four4fish/pytorch-lightning
that referenced
this pull request
Aug 16, 2021
12 tasks
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?
Fixes current IPU CI failures.
Shortens IPU CI
Error:
We were getting the following error:
The cause was that we were calling
replace_sampler
(which re-creates the dataloader with the correct sampler) first and_convert_to_poptorch_loader
as a second post-process of the dataloaders which also requires recreating the dataloader.However, in the first re-creation, a batch sampler is given which by the internal DataLoader design, sets
batch_size = None
.This means that on the second re-creation, we do it it with
batch_size = None
anddrop_last = True
which raises theValueError
observed.To fix this, we avoid doing this double re-creation and instead monkey-patch the function so the
poptorch.DataLoader
is used directly. This required splittingreplace_sampler
into two static methods to avoid code duplication.Even though monkey-patching like this is hacky, this solution was chosen because the IPU plugin is highly experimental and subject to change so we did not want to add an abstraction to the
Accelerator
/TrainingTypePlugin
to support this.Finally, some other bug fixes were required to pass the correct
RunningStage
around.Does your PR introduce any breaking changes? If yes, please list them.
Accelerator
API:on_reset_{train,val,test,predict}_dataloader
have been removed as they aren't necessary anymore. We don't process the dataloader twice after this PR.Trainer.request_dataloader
now takes aRunningStage
instead ofstr
. Not sure how public is this function.Before submitting
PR review