# Accessing logits when using Trainer API

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Faccessing-logits-when-using-trainer-api%2F67555%3E%5C
**Category:** Beginners\
**Created:** [December 31, 2023, 1:20pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Faccessing-logits-when-using-trainer-api%2F67555 "2023-12-31T13:20:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pvversteeg](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@pvversteeg](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpvversteeg)%5C
**Post date:** [December 31, 2023, 1:20pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Faccessing-logits-when-using-trainer-api%2F67555%2F1 "2023-12-31T13:20:27Z")

</div>

Hi,

I’ve been learning to finetune a model using this [guide](https://huggingface.co/learn/nlp-course/chapter3/3). Now, for my thesis project I want to access the logits for the training samples at the end of every epoch, so preferably in the `compute-metrics` function. This function gets `eval-preds`, but is there anyway to have it get access to something like `train-preds`? If it’s unclear, I’m looking to log the logits of every training sample at the end of every epoch.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [January 1, 2024, 6:11pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Faccessing-logits-when-using-trainer-api%2F67555%2F2 "2024-01-01T18:11:59Z")

</div>

Hi,

This thread may help you: [Metrics for Training Set in Trainer - #7 by Kaveri](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmetrics-for-training-set-in-trainer%2F2461%2F7)
