Which line of code is throwing this error?
The sampler should rerun a single index and it works fine in this dummy code snippet:
dataset = TensorDataset(
    torch.arange(10).float())

weights = [0.1] * 10
sampler = WeightedRandomSampler(weights, len(weights))
loader = DataLoader(dataset, sampler=sampler)

for x in loader:
    print(x)