Jaideep_Valani:

sampler=SequentialSampler(train_dataset),


I’m guessing that train_dataset should be valid_dataset since that is your sampler is for the validation set.  That index is likely one that is only applicable to the training dataset which is larger.