# Set\_transform vs with\_transform

**URL:** <https://discuss.huggingface.co/t/set-transform-vs-with-transform/20326>\
**Category:** Beginners\
**Created:** [July 13, 2022, 10:38am UTC](https://discuss.huggingface.co/t/set-transform-vs-with-transform/20326 "2022-07-13T10:38:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Talha](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@Talha](https://discuss.huggingface.co/u/Talha)\
**Post date:** [July 13, 2022, 10:38am UTC](https://discuss.huggingface.co/t/set-transform-vs-with-transform/20326/1 "2022-07-13T10:38:38Z")

</div>

In huggingface dataset, i found two ways of transformation. [with\_transform](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.with_transform) and [set\_transform](https://huggingface.co/docs/datasets/v2.3.2/en/package_reference/main_classes#datasets.Dataset.set_transform)  
What is the difference between two and which one to use in image classification

---

<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:** [July 13, 2022, 11:49am UTC](https://discuss.huggingface.co/t/set-transform-vs-with-transform/20326/2 "2022-07-13T11:49:35Z")

</div>

Hi! The only difference is that `set_transform` modifies a dataset in-place and `with_transform` returns a new dataset with the specified transform. Which of these two approaches you want to use is up to you.
