# Returning logits from Trainer.predict()

**URL:** <https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314>\
**Category:** Beginners\
**Created:** [August 18, 2021, 5:27am UTC](https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314 "2021-08-18T05:27:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehalit](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ehalit/32/28854_2.png) [@ehalit](https://discuss.huggingface.co/u/ehalit)\
**Post date:** [August 18, 2021, 5:27am UTC](https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314/1 "2021-08-18T05:27:08Z")

</div>

Hello!

I would like to perform some operations on the output probability distributions of an `AutoModelForSequenceClassification` model so, I was wondering if it is possible to return the logits rather than predicted class labels from the `transformers.Trainer.predict()` method.

---

<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:** [August 30, 2021, 6:12pm UTC](https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314/2 "2021-08-30T18:12:22Z")

</div>

The predict method does return the logits, as well as the labels.

---

<div class="post-metadata">

**Author:** ![ehalit](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ehalit/32/28854_2.png) [@ehalit](https://discuss.huggingface.co/u/ehalit)\
**Post date:** [August 31, 2021, 4:53am UTC](https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314/3 "2021-08-31T04:53:28Z")

</div>

Thank you for the reply, I realized how stupid of a mistake mine was, but I couldn’t delete the post. It surely does return the logits.

---

<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:** [August 31, 2021, 10:53am UTC](https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314/4 "2021-08-31T10:53:07Z")

</div>

No worries, there are no stupid questions 🙂
