data
data copied to clipboard
Make DistributedSampler stateful
🚀 The feature
Currently RandomSampler, BatchSampler are patched here https://github.com/pytorch/data/blob/main/torchdata/stateful_dataloader/sampler.py#L134-L135 to make them stateful and work out of the box with StatefulDataLoader.
It would be useful to consider making DistributedSampler (https://github.com/pytorch/pytorch/blob/2176ef7dfaf02dd6dbb8484a50c99d5fadf3ea0b/torch/utils/data/distributed.py#L13) also implement stateful methods and patch it in torchdata.
Motivation, pitch
So that users can use DistributedSampler also out of the box with checkpointing capability
Alternatives
Users would have implement the stateful interface for DistributedSampler but extending it
Additional context
No response