# Accessing logits when using Trainer API

**URL:** <https://discuss.huggingface.co/t/accessing-logits-when-using-trainer-api/67555>\
**Category:** Beginners\
**Created:** [December 31, 2023, 1:20pm UTC](https://discuss.huggingface.co/t/accessing-logits-when-using-trainer-api/67555 "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](https://discuss.huggingface.co/u/pvversteeg)\
**Post date:** [December 31, 2023, 1:20pm UTC](https://discuss.huggingface.co/t/accessing-logits-when-using-trainer-api/67555/1 "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](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [January 1, 2024, 6:11pm UTC](https://discuss.huggingface.co/t/accessing-logits-when-using-trainer-api/67555/2 "2024-01-01T18:11:59Z")

</div>

Hi,

This thread may help you: [Metrics for Training Set in Trainer - #7 by Kaveri](https://discuss.huggingface.co/t/metrics-for-training-set-in-trainer/2461/7)
