I am implementing a multi class image classification model in PyTorch. However my data is not balanced, so I used the  WeightedRandomSampler  in PyTorch to create a custom dataloader. But here, I have one doubt that for eg. if my total number of classes is four time more than the batch size I am using to train the model (which is different from general scenario), if I would use replacement= True in WeightedRandomSampler, than wouldn’t it happen that in my loader I wouldn’t get images from some of the classes. for eg. The 3/4 th classes instances. As, replacement= True oversamples the instance by repeating.
Also, to effectively use  WeightedRandomSampler with replacement= False, we have to control its total samples, so that we don’t iterate over entire dataset, is there anything like this that needs to take care of while using replacement= True
Also, to be clear about my dataset, it has around 2000 classes in long tail distribution and Batch size is 64