You are required to specify either of sampler or shuffle as arguments to the dataloader.
You cannot specify both.
In case, you want the data to be shuffled at every epoch and get sampled according to a randomsampler, specify shuffle=True and remove the sampler argument.
If you specify a sampler, the sampling scheme implied by your custom sampler shall be used.