Based on the description of your use case, it seems you are working on a multi-label classification use case. In that case I don’t think that the WeightedRandomSampler can be used easily to balance the batches. This post 4 explains other methods how these use cases can potentially be balanced.