# How to use data_utils.WeightedRandomSampler and still be able shuffle training data in Pytorch?

I am working on the multi-label classification task in Pytorch and I have imbalanced data in my model, therefore I use data_utils.WeightedRandomSampler method which helps me to balance my weights during the training part. However, it has its disadvantage , according to the pytorch if sampler is chosen, then Dataloader cannot shuffle data, i.e. it should be set to false as follows:

trainloader = data_utils.DataLoader(train, batch_size = batch_size, sampler = sampler, shuffle=False, num_workers = 0)


I was wondering if there is any way to avoid it, since I really prefer to shuffle my data during training since as I noticed, the accuracy is increased in that case.