# Custom model for Trainer

**URL:** <https://discuss.huggingface.co/t/custom-model-for-trainer/45921>\
**Category:** 🤗Transformers\
**Created:** [July 6, 2023, 3:42pm UTC](https://discuss.huggingface.co/t/custom-model-for-trainer/45921 "2023-07-06T15:42:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oran-sh](https://avatars.discourse-cdn.com/v4/letter/o/a4c791/32.png) [@oran-sh](https://discuss.huggingface.co/u/oran-sh)\
**Post date:** [July 6, 2023, 3:42pm UTC](https://discuss.huggingface.co/t/custom-model-for-trainer/45921/1 "2023-07-06T15:42:27Z")

</div>

Hello,  
trying to figure out everything needed when I train a custom model with trainer.

1. As far as I understand - output should be tuple with loss value first.
2. the function provided to compute\_metrics takes EvalPrediction. How is the value passed to my compute metrics function created? How does trainer know how to build the input to this compute\_metrics function

Thanks!

---

<div class="post-metadata">

**Author:** ![oran-sh](https://avatars.discourse-cdn.com/v4/letter/o/a4c791/32.png) [@oran-sh](https://discuss.huggingface.co/u/oran-sh)\
**Post date:** [July 8, 2023, 8:02pm UTC](https://discuss.huggingface.co/t/custom-model-for-trainer/45921/2 "2023-07-08T20:02:22Z")

</div>

Up. Any answer for this? 😊
