danman:

Using 10 dataloaders is the best way to do this? Because then there is much copy-paste code — maybe there is a cleaner way?


Maybe appending the loaders into e.g. a list would be cleaner and avoid code duplication.



 danman:

I guess the best way to do this data split/data preparation is not in PyTorch but with Numpy, Pandas, Vanilla Python whatever.


Yes, I would claim the easiest approach would be to reuse an already implemented method in any of these mentioned packages. One approach could be to create a WeightedRandomSampler in PyTorch using the desired class distribution and create the 10 loaders with them.