# Datasets - how to add augmentations?

**URL:** <https://discuss.huggingface.co/t/datasets-how-to-add-augmentations/59788>\
**Category:** 🤗Datasets\
**Created:** [October 25, 2023, 4:13am UTC](https://discuss.huggingface.co/t/datasets-how-to-add-augmentations/59788 "2023-10-25T04:13:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ifedorov](https://avatars.discourse-cdn.com/v4/letter/i/ac8455/32.png) [@ifedorov](https://discuss.huggingface.co/u/ifedorov)\
**Post date:** [October 25, 2023, 4:13am UTC](https://discuss.huggingface.co/t/datasets-how-to-add-augmentations/59788/1 "2023-10-25T04:13:01Z")

</div>

Hi. I want to add random augmentations to my dataset. Meaning that I do not want to perform augmentations once during the creating of the dataset, but rather to generate the augmentation randomly during training. This is usually implemented in **getitem** method of default pytorch dataset class. Is it possible to make this functionality with current version of Datasets package?

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](https://discuss.huggingface.co/u/mariosasko)\
**Post date:** [October 25, 2023, 4:09pm UTC](https://discuss.huggingface.co/t/datasets-how-to-add-augmentations/59788/2 "2023-10-25T16:09:27Z")

</div>

You can use [`set_transform`](https://huggingface.co/docs/datasets/v2.14.5/en/process#format-transform) for this.
