Training model with ImageNet

I am training a model on ImageNet Dataset but cannot resolve the following error

lib/python3.6/site-packages/torchvision/datasets/", line 231, in getitem
path, target = self.samples[index]
IndexError: list index out of range

The error is quite strange, as the dataset should check the number of samples and use it as the range for the indices. Could you add a print statement into the __getitem__ and check which value index has as well as was len(dataset) returns?

I resolved the error as the number of training images was set as 50,000 images for other datasets so indexing was bigger than the images I wanted to train.
Thank you!