# Track more than one loss using Trainer and Wandb

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrack-more-than-one-loss-using-trainer-and-wandb%2F83015%3E%5C
**Category:** Intermediate\
**Created:** [April 22, 2024, 5:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrack-more-than-one-loss-using-trainer-and-wandb%2F83015 "2024-04-22T05:24:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![israfelsr](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@israfelsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fisrafelsr)%5C
**Post date:** [April 22, 2024, 5:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrack-more-than-one-loss-using-trainer-and-wandb%2F83015%2F1 "2024-04-22T05:24:50Z")

</div>

I’ve been searching for this information in the forum for a while now and haven’t found any satisfactory answers. I’m currently training a model with the Hugging Face Trainer and tracking the loss with Wandb. In the forward function of my model, I have something like this:

```python
loss = loss_1 + loss_2
return ModelOutput(
    loss=loss,
    ...)

```

What would be the best way to track all the losses here? Currently, Wandb only tracks the one included in the model output.

---

<div class="post-metadata">

**Author:** ![zipzou](https://avatars.discourse-cdn.com/v4/letter/z/a587f6/32.png) [@zipzou](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fzipzou)%5C
**Post date:** [July 11, 2024, 2:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrack-more-than-one-loss-using-trainer-and-wandb%2F83015%2F2 "2024-07-11T02:13:07Z")

</div>

Try to use my implementation: [https://github.com/zipzou/hf-multitask-trainer](https://github.com/zipzou/hf-multitask-trainer). It is easy to use.
