# How to use Huggingface Trainer streaming Datasets without wrapping it with torchdata's IterableWrapper?

**URL:** <https://discuss.huggingface.co/t/how-to-use-huggingface-trainer-streaming-datasets-without-wrapping-it-with-torchdatas-iterablewrapper/25230>\
**Category:** 🤗Datasets\
**Created:** [October 30, 2022, 6:17pm UTC](https://discuss.huggingface.co/t/how-to-use-huggingface-trainer-streaming-datasets-without-wrapping-it-with-torchdatas-iterablewrapper/25230 "2022-10-30T18:17:22Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![alvations](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alvations/32/97_2.png) [@alvations](https://discuss.huggingface.co/u/alvations)\
**Post date:** [October 30, 2022, 6:20pm UTC](https://discuss.huggingface.co/t/how-to-use-huggingface-trainer-streaming-datasets-without-wrapping-it-with-torchdatas-iterablewrapper/25230/2 "2022-10-30T18:20:33Z")

</div>

Found the answer from [Using IterableDataset with Trainer - `IterableDataset' has no len()](https://discuss.huggingface.co/t/using-iterabledataset-with-trainer-iterabledataset-has-no-len/15790)

By adding the with format to the iterable dataset, like this:

```auto
train_data.with_format("torch")

```

The trainer should work without throwing the `len()` error.

```auto
# instantiate trainer
trainer = Seq2SeqTrainer(
    model=multibert,
    tokenizer=tokenizer,
    args=training_args,
    train_dataset=train_data.with_format("torch"),
    eval_dataset=train_data.with_format("torch"),
)

trainer.train()

```

---

_[View the full topic](https://discuss.huggingface.co/t/how-to-use-huggingface-trainer-streaming-datasets-without-wrapping-it-with-torchdatas-iterablewrapper/25230)._
