twister9458:

My question please: Using WeightedRandomSampler gives me bad results rather than without using it. (74% vs 91% accuracies)
Is there any logical explanation for this ?


You might be running into the Accuracy Paradox 2, which explains that the accuracy might be a misleading metric for imbalanced classification use cases.
E.g. in case the majority class occurs in 91% of all cases, your model might only predict this single class to achieve the accuracy of 91%. While the model would be not very useful, the accuracy “looks good”.
Balancing the dataset might thus reduce the accuracy, but increase other metrics such as the F1 score.