-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Fix DataLoader to Pass List to getitems When Using BatchSampler. Fixes Issue_#154810 #154844
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154844
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 2 Cancelled Jobs, 1 Unrelated FailureAs of commit 3a2b25e with merge base ff4515f ( NEW FAILURE - The following job has failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@aritra3520 why are you pinging people the minute you create an issue? |
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.
PR description lacks any explanation of what is fixed and how (I.e. title should not simply reference the issue number )
Also please add test
Hi I am sorry for any inconvenience caused, actually i have started new in this upstream contribuiton. Actually I was unaware of the protocols that should be maintained. I will adhere to them in future. But again am really sorry. Also thank you for the review I will surely make the changes that you stated. |
I have updated with the necessary changes |
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
This PR fixes an issue where PyTorch's DataLoader did not always pass a list of indices to custom Datasets implementing getitems when using a BatchSampler. Instead, a single integer could be passed, causing 2D tensor outputs to be incorrectly flattened in the collate function.
Root cause:
In MapDatasetFetcher.fetch, the type of indices (possibly_batched_index) was not checked before being passed to getitems. If the indices were not already a list, this led to unexpected results for batch-aware Datasets.
What’s fixed:
Test coverage:
Fixes #154810