Hi @para, the thread above explains exactly what you need to do if you want to use class weights to handle an imbalanced dataset.
But if you are not sure what class weights are, what they do or how to overwrite the Trainer yourself I’d suggest that you take more time first to really understand the concepts and how it works.
You can also have a look at Simpletransformer.ai - it already implements class weight handling 1. But be aware that blindly trying out something will probably not give you the best results.
Additional note: it seems to be a common rule of thumb that the largest class should be max 10 times bigger than the smallest class. If this is not the case, you can try sampling techniques on your data as suggested here.