-
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
Relax restrictions on wrapping a custom batch sampler in predict #19678
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
for more information, see https://pre-commit.ci
…AI/lightning into bugfix/custom-sampler-predict
awaelchli
changed the title
WIP: Allow wrapping a custom batch sampler in predict
Relax restrictions on wrapping a custom batch sampler in predict
Mar 20, 2024
awaelchli
added
feature
Is an improvement or enhancement
data handling
Generic data-related topic
trainer: predict
labels
Mar 20, 2024
awaelchli
requested review from
carmocca,
justusschock,
Borda and
williamFalcon
as code owners
March 20, 2024 17:57
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #19678 +/- ##
==========================================
- Coverage 83% 53% -30%
==========================================
Files 424 416 -8
Lines 34910 34760 -150
==========================================
- Hits 29086 18439 -10647
- Misses 5824 16321 +10497 |
carmocca
approved these changes
Mar 22, 2024
Borda
approved these changes
Mar 27, 2024
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
feature
Is an improvement or enhancement
pl
Generic label for PyTorch Lightning package
ready
PRs ready to be merged
trainer: predict
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 #19657
Relaxes the requirement that your custom batch sampler needed to subclass PyTorch's Sampler or BatchSampler and expose a
drop_last
argument, specifically in the case of the predict loop. Now, the user can pass any batch sampler to the DataLoader as long as it follows PyTorch's requirements, but we will warn the user that Lightning can't guarantee that all samples are returned.📚 Documentation preview 📚: https://pytorch-lightning--19678.org.readthedocs.build/en/19678/
cc @Borda @justusschock @awaelchli