We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 52460d3 commit 58a749aCopy full SHA for 58a749a
src/lightning/pytorch/utilities/data.py
@@ -351,7 +351,11 @@ def _is_dataloader_shuffled(dataloader: object) -> bool:
351
# shuffling is enabled via a sampler. No sampler, no shuffling
352
return False
353
batch_sampler = dataloader.batch_sampler
354
- sampler = batch_sampler.sampler if batch_sampler is not None else dataloader.sampler
+ if batch_sampler is not None:
355
+ # custom batch samplers may not have an internal .sampler
356
+ sampler = batch_sampler.sampler if hasattr(batch_sampler, "sampler") else batch_sampler
357
+ else:
358
+ sampler = dataloader.sampler
359
if isinstance(sampler, SequentialSampler):
360
361
return isinstance(sampler, RandomSampler)
0 commit comments