# How to add custom labels and shuffle

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-add-custom-labels-and-shuffle%2F46055%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 7, 2023, 11:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-add-custom-labels-and-shuffle%2F46055 "2023-07-07T23:10:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![surya-narayanan](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@surya-narayanan](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsurya-narayanan)%5C
**Post date:** [July 7, 2023, 11:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-add-custom-labels-and-shuffle%2F46055%2F1 "2023-07-07T23:10:54Z")

</div>

I want to shuffle a streaming dataset but change the labels.

Without shuffling, I do

`dataset = IterableDataset(...)`

In my training loop I do

```auto
for batch in dataset:
    batch['labels'] = mylabels
    outputs = model(batch)
    outputs.loss.backward()

```

What would be a good way to shuffle in here?
