# Saving eval loss for every evaluation/saved checkpoint with Trainer

**URL:** <https://discuss.huggingface.co/t/saving-eval-loss-for-every-evaluation-saved-checkpoint-with-trainer/10477>\
**Category:** 🤗Transformers\
**Created:** [October 3, 2021, 6:50pm UTC](https://discuss.huggingface.co/t/saving-eval-loss-for-every-evaluation-saved-checkpoint-with-trainer/10477 "2021-10-03T18:50:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BramVanroy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bramvanroy/32/47360_2.png) [@BramVanroy](https://discuss.huggingface.co/u/BramVanroy)\
**Post date:** [October 3, 2021, 6:50pm UTC](https://discuss.huggingface.co/t/saving-eval-loss-for-every-evaluation-saved-checkpoint-with-trainer/10477/1 "2021-10-03T18:50:40Z")

</div>

I am running the trainer with

```auto
--do_eval --report_to none --evaluation_strategy epoch --num_train_epochs 10 

```

so I am expecting the trainer to evaluate after every epoch and saving those results in either `eval_results.json` or `all_results.json`. But those files unfortunately only contain the results of the last evaluation.

It is useful that checkpoints are saved, but I cannot seem to find the evaluation results for each checkpoint. That would be very useful to select the optimal checkpoint.

---

<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:** [October 4, 2021, 12:17pm UTC](https://discuss.huggingface.co/t/saving-eval-loss-for-every-evaluation-saved-checkpoint-with-trainer/10477/2 "2021-10-04T12:17:13Z")

</div>

There will be in the `log_history` field of the `trainer_state`, which is also saved in the same folder.

---

<div class="post-metadata">

**Author:** ![BramVanroy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bramvanroy/32/47360_2.png) [@BramVanroy](https://discuss.huggingface.co/u/BramVanroy)\
**Post date:** [October 4, 2021, 12:46pm UTC](https://discuss.huggingface.co/t/saving-eval-loss-for-every-evaluation-saved-checkpoint-with-trainer/10477/3 "2021-10-04T12:46:42Z")

</div>

Excellent, thanks!
