Skip to content

Commit

Permalink
Revert "Fix IterableDataset with __len__ in Trainer (huggingface#8095)"
Browse files Browse the repository at this point in the history
This reverts commit 613fe32.
  • Loading branch information
fabiocapsouza authored Nov 15, 2020
1 parent 9d4869a commit c13c3f3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c13c3f3

Please sign in to comment.