Allow shuffle when auto-batching disabled in DataLoader
#35761
Labels
enhancement
Not as big of a feature, but technically not a bug. Should be easy to fix
module: dataloader
Related to torch.utils.data.DataLoader and Sampler
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
🚀 Feature
Allow
DataLoader(batch_size=None, shuffle=True)
Motivation
My model handles one sample a time. So, I don't need auto-batching, but I want my dataset to be shuffled. However, when I use
DataLoader(batch_size=None, shuffle=True)
, it raisesbatch_size=None option disables auto-batching and is mutually exclusive with shuffle, and drop_last
.But I can't see why they are mutually exclusive.
Pitch
Allow
DataLoader(batch_size=None, shuffle=True)
.Basically, just remove the
shuffle
check from this line:pytorch/torch/utils/data/dataloader.py
Line 202 in ada6472
Alternatives
I can:
batch_size=1
then remove the batching dimension afterwardssampler=RandomSampler(dataset)
But these makes me feel like I'm fighting with DataLoader. Why I cannot just use
shuffle=True
?Additional context
cc @ssnl
The text was updated successfully, but these errors were encountered: