# Mullti Label Text Classification

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmullti-label-text-classification%2F44233%3E%5C
**Category:** 🤗Transformers\
**Created:** [June 22, 2023, 10:03pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmullti-label-text-classification%2F44233 "2023-06-22T22:03:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rvienne](https://avatars.discourse-cdn.com/v4/letter/r/50afbb/32.png) [@rvienne](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frvienne)%5C
**Post date:** [June 23, 2023, 7:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmullti-label-text-classification%2F44233%2F2 "2023-06-23T07:45:06Z")

</div>

Hello @ayush-adeptmind,  
From my understanding of your question you want to introduce a weighted loss into your multilabel classification problem.  
For such a problem, the best way to do I’m aware of while using transformers library is to override the Trainer class (create a new trainer class which inherits from the actual Trainer) and override (by defining it again) the “compute\_loss” method.  
When instanciating BCEWithLogitsLoss, you should be able to insert a weight vector.

See [How can I use class\_weights when training?](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-class-weights-when-training%2F1067) for more precise information and code snippets.

Have a good day!

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmullti-label-text-classification%2F44233)._
