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

fork dataloader __init__ instead of patching samplers #1281

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

andrewkho
Copy link
Contributor

@andrewkho andrewkho commented Jul 1, 2024

Fixes #1280

Currently we patch torch.utils.data's BatchSampler and RandomSampler in order to add statefulness to them. This is way too aggressive.

Instead let's just fork the dataloader init for now and merge back into core once the time is right.

Changes

  • Stop patching torch.utils.data's BatchSampler and RandomSampler
  • Fork dataloader's init and pass in the Stateful BatchSampler and RandomSampler instead.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 1, 2024
Copy link

pytorch-bot bot commented Jul 1, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/data/1281

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit c8017ed with merge base b0e25e2 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Contributor

@gokulavasan gokulavasan left a comment

Choose a reason for hiding this comment

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

looks great!

@andrewkho andrewkho merged commit b421e86 into main Jul 2, 2024
44 checks passed
@andrewkho andrewkho deleted the andrewkh/dont-patch-samplers branch July 2, 2024 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing torchdata.stateful_dataloader hides torch RandomSampler and BatchSampler
3 participants