DataLoader - using SubsetRandomSampler and WeightedRandomSampler at the same time

My linked example shows how to use the targets to create sample weights and pass it to the WeightedRandomSampler. Does it not work for you? If not, what issues are you seeing and could you post a code snippet showing these?