Based on the blog post you shared, it seems you are dealing with two datasets.
One is balanced and uses the RandomSampler, while the other is imbalanced and calls into ExampleImbalancedDatasetSampler.
Inside the ExampleImbalancedDatasetSampler, dataset.samples is used, which is apparently raising the error.
I’m not sure, what kind of datasets you are using, but you should change the dataset.samples call to whatever fits your dataset.