# What is the difference between Trainer.evaluate() and Trainer.predict()?

**URL:** <https://discuss.huggingface.co/t/what-is-the-difference-between-trainer-evaluate-and-trainer-predict/20708>\
**Category:** 🤗Transformers\
**Created:** [July 22, 2022, 4:42am UTC](https://discuss.huggingface.co/t/what-is-the-difference-between-trainer-evaluate-and-trainer-predict/20708 "2022-07-22T04:42:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheNoob3131](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@TheNoob3131](https://discuss.huggingface.co/u/TheNoob3131)\
**Post date:** [July 22, 2022, 4:42am UTC](https://discuss.huggingface.co/t/what-is-the-difference-between-trainer-evaluate-and-trainer-predict/20708/1 "2022-07-22T04:42:57Z")

</div>

So these are the 2 tutorials I am looking at for Image Classification using ViTs:

> **[Fine-Tune ViT for Image Classification with 🤗 Transformers](https://huggingface.co/blog/fine-tune-vit)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[A complete Hugging Face tutorial: how to build and train a vision transformer...](https://theaisummer.com/hugging-face-vit/#training-the-model)**
>
> Learn about the Hugging Face ecosystem with a hands-on tutorial on the datasets and transformers library. Explore how to fine tune a Vision Transformer (ViT)

However, the first one from Huggingface uses trainer.evaluate() to output the metrics, while AI Summer uses trainer.predict(). Is there any substantial difference between the two or are they interchangeable?

FYI, the models I am using are ‘google/vit-base-patch16-224-in21k’, ‘microsoft/cvt-13’, ‘microsoft/resnet-50’, and ‘facebook/convnext-base-224-22k’.

---

<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 22, 2022, 7:49am UTC](https://discuss.huggingface.co/t/what-is-the-difference-between-trainer-evaluate-and-trainer-predict/20708/2 "2022-07-22T07:49:00Z")

</div>

They can both be used, they just have slightly different outputs. `evaluate` is thought as “Evaluate on the validation dataset on labeled data” while `predict` is more of a “Predict on new unlabeled data” (but if you have labels, it will compute the metrics).
