Could you explain your idea using the WeightedRandomSampler a bit?
I’m not sure I understand it properly.
It seems you are restricting the number of samples per epoch using the Dataset's __len__ method?
If you use WeightedRandomSampler with equal weights and replacement=True, you might get some duplicated samples.
If you just want to iterate your dataset, you don’t have to use a special sampler, as the default one will just use each sample once.