# How to customize dataloader creation in trainer?

**URL:** <https://discuss.huggingface.co/t/how-to-customize-dataloader-creation-in-trainer/8681>\
**Category:** 🤗Transformers\
**Created:** [July 26, 2021, 5:40am UTC](https://discuss.huggingface.co/t/how-to-customize-dataloader-creation-in-trainer/8681 "2021-07-26T05:40:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZW1](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@ZW1](https://discuss.huggingface.co/u/ZW1)\
**Post date:** [July 26, 2021, 5:40am UTC](https://discuss.huggingface.co/t/how-to-customize-dataloader-creation-in-trainer/8681/1 "2021-07-26T05:40:00Z")

</div>

Is there a way I could re-create the dataloader after each epoch through a custom function when using trainer?

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [July 26, 2021, 1:12pm UTC](https://discuss.huggingface.co/t/how-to-customize-dataloader-creation-in-trainer/8681/2 "2021-07-26T13:12:12Z")

</div>

No, you should probably use a manual training loop for that, using the Accelerate library.
