1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.