Unverified Commit 0c17e766 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Error when group_by_length is used with an IterableDataset (#15437)

parent 125a2882
...@@ -422,6 +422,13 @@ class Trainer: ...@@ -422,6 +422,13 @@ class Trainer:
if train_dataset is not None and not isinstance(train_dataset, collections.abc.Sized) and args.max_steps <= 0: if train_dataset is not None and not isinstance(train_dataset, collections.abc.Sized) and args.max_steps <= 0:
raise ValueError("train_dataset does not implement __len__, max_steps has to be specified") raise ValueError("train_dataset does not implement __len__, max_steps has to be specified")
if (
train_dataset is not None
and isinstance(train_dataset, torch.utils.data.IterableDataset)
and args.group_by_length
):
raise ValueError("the `--group_by_length` option is only available for `Dataset`, not `IterableDataset")
self._signature_columns = None self._signature_columns = None
# Mixed precision setup # Mixed precision setup
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment