How can I use class_weights when training?

Answering my own question:
Subclass Trainer and override the compute_loss method (see example here).

6 Likes