diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index 942ddde04d1f01..a546b731fcb73a 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -384,9 +384,7 @@ def _remove_unused_columns(self, dataset: "datasets.Dataset", description: Optio dataset.set_format(type=dataset.format["type"], columns=columns) def _get_train_sampler(self) -> Optional[torch.utils.data.sampler.Sampler]: - if isinstance(self.train_dataset, torch.utils.data.IterableDataset) or not isinstance( - self.train_dataset, collections.abc.Sized - ): + if not isinstance(self.train_dataset, collections.abc.Sized): return None elif is_torch_tpu_available(): return get_tpu_sampler(self.train_dataset)