Thank you for your help, it is really appreciated.
I have switched to using nn.BCEWithLogitsLoss(pos_weight=pos_weight) as it seems to be the easiest solution.
Just to be sure, if I have a dataset repartition of 80%  of negative example and 20% of positive example, then pos_weight should be 4 right ?
Have a nice day !