You could start by setting the weights as the inverse of the class counts or the inverse of your current weight tensor.
In your current approach you would weight the majority class the highest.
Also, you could try to oversample the minority classes using WeightedRandomSampler.
I’ve created a dummy example here 10.