I think I was not able to frame my question properly. In the SGD optimizer I was using the parameters of the model.pretrained_model as
model.pretrained_model[0][24].parameters()
for which it gave 'DataParallel' object does not support indexing error. But, If I change it to
model.pretrained_model.module[0][24].parameters()
it didn’t give any indexing error.
Thank you.