# Get multiple metrics when using the huggingface trainer

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-multiple-metrics-when-using-the-huggingface-trainer%2F15817%3E%5C
**Category:** 🤗Transformers\
**Created:** [March 17, 2022, 5:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-multiple-metrics-when-using-the-huggingface-trainer%2F15817 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fhawoihgawjlj)%5C
**Post date:** [March 17, 2022, 6:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-multiple-metrics-when-using-the-huggingface-trainer%2F15817%2F3 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Flog-multiple-metrics-while-training%2F8115)). 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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-multiple-metrics-when-using-the-huggingface-trainer%2F15817)._
