Closed maxkrieger closed 1 year ago
Thanks for opening the issue. What exactly is the regression here? On which version of Transformers did it work and when did it stop working?
As the error clearly states (copying the full error message would be helpful by the way), you need to use max_steps
in your training arguments instead of num_train_epochs
since your dataset doesn't have a length.
Hey @sgugger, sorry for the missing information. According to this forum post, the fix for this exact error is to cast the dataset to a torch dataset as described above. However, the error persists. I have not bisected to figure out if it really is a regression, but it seems so from the code online.
Hi @maxkrieger - in the forum post that you have provided you can see that the training_args
already contains argument max_steps=1e6
. In order for your sample to work correctly, you need to both set the max_steps
argument as well as format your dataset for Pytorch.
Additionally if I am not mistaken after specifying max_steps
argument you can drop num_train_epochs
since it will be override anyways .
Aahh 🤦 somehow missed that parameter while reading the snippets @Bearnardd. Apologies for the lack of diligence, this is resolved.
System Info
transformers
version: 4.24.0Who can help?
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Run the
Trainer
with a dataset withstreaming=True
, making it iterable. To make theTrainer
train_dataset
work with streaming, use.with_format("torch")
(as suggested in https://github.com/huggingface/datasets/issues/2583#issuecomment-874078780 and here).A simple repro is below and in this colab
which yields
Expected behavior
TorchIterableDataset
should implement__len__
but doesn't. It instead has a.dataset_size
method.