WeightedRandomSampler is not sampling balanced batchs

Your code isn’t executable so I cannot debug it but you could take a look at this example which shows the oversampling of the minority classes using a fake dataset.