# Class weights for bertForSequenceClassification

**URL:** <https://discuss.huggingface.co/t/class-weights-for-bertforsequenceclassification/1674>\
**Category:** Beginners\
**Created:** [October 21, 2020, 2:17pm UTC](https://discuss.huggingface.co/t/class-weights-for-bertforsequenceclassification/1674 "2020-10-21T14:17:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 21, 2020, 2:34pm UTC](https://discuss.huggingface.co/t/class-weights-for-bertforsequenceclassification/1674/2 "2020-10-21T14:34:12Z")

</div>

No, you need to compute the loss outside of the model for this. If you’re using `Trainer`, see [here](https://huggingface.co/transformers/main_classes/trainer.html) on how to change the loss form the default computed by the model.

---

_[View the full topic](https://discuss.huggingface.co/t/class-weights-for-bertforsequenceclassification/1674)._
