The loss will be rescaled with the weights as described in the docs 263 if you keep reduction='mean'. You can see in the formula, that each sample loss will be divided by the corresponding weight.
This also means, you shouldn’t have to change the learning rate or other parameters.
Is there a reason you are using reduction='sum'?
If you need to apply it, you would have to rescale the loss manually.
I don’t think changing other hyperparameters like the learning rate might be a good idea, since your “summed” loss will depend on the current class distribution in the batch and thus might mess up your training.