Thanks for the reply! So I tried converting sampling_weights to a tensor as follows:
sampling_weights = torch.FloatTensor(sampling_weights)
This got me the same error as before. I also tried doing sampling_weights = torch.from_numpy(sampling_weights) and I get a different error:
TypeError: expected np.ndarray (got list)
Do you think I should take a different approach entirely to generating my sampling weights?