# Get multiple metrics when using the huggingface trainer

**URL:** <https://discuss.huggingface.co/t/get-multiple-metrics-when-using-the-huggingface-trainer/15817>\
**Category:** 🤗Transformers\
**Created:** [March 17, 2022, 5:53pm UTC](https://discuss.huggingface.co/t/get-multiple-metrics-when-using-the-huggingface-trainer/15817 "2022-03-17T17:53:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![hawoihgawjlj](https://avatars.discourse-cdn.com/v4/letter/h/c6cbf5/32.png) [@hawoihgawjlj](https://discuss.huggingface.co/u/hawoihgawjlj)\
**Post date:** [March 17, 2022, 6:15pm UTC](https://discuss.huggingface.co/t/get-multiple-metrics-when-using-the-huggingface-trainer/15817/3 "2022-03-17T18:15:05Z")

</div>

Hi Thanks for the reply. There’s no certain reason that I used a dictionary because I just followed the way in this discussion ([Log multiple metrics while training](https://discuss.huggingface.co/t/log-multiple-metrics-while-training/8115)). I also tried `return pr, f1` as you suggested but it showed me another error:

```auto
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-3435b262f1ae> in <module>()
----> 1 trainer.train()

3 frames
/usr/local/lib/python3.7/dist-packages/transformers/trainer.py in evaluation_loop(self, dataloader, description, prediction_loss_only, ignore_keys, metric_key_prefix)
   2511 
   2512 if all_losses is not None:
-> 2513 metrics[f"{metric_key_prefix}_loss"] = all_losses.mean().item()
   2514 
   2515 # Prefix all keys with metric_key_prefix + '_'

TypeError: 'tuple' object does not support item assignment

```

---

_[View the full topic](https://discuss.huggingface.co/t/get-multiple-metrics-when-using-the-huggingface-trainer/15817)._
