HI, all, A strange error occurred when loading the pre-trained model.
The pre-trained model was trained in Pytorch DataParallel mode. And I try to load the model to test new data.
model = torch.nn.DataParallel(model).cuda()
model.load_state_dict(checkpoint['state_dict'])

The pre-trained model is loaded correctly. However if code is modified as
model = model.cuda()
model.load_state_dict(checkpoint['state_dict'])

Error occurs as following
  File "/mnt/lustre/zhangyi/pytorch-laneseg/gen_png_result.py", line 47, in main
    model.load_state_dict(checkpoint['state_dict'])
  File "/usr/lib64/python2.7/site-packages/torch/nn/modules/module.py", line 331, in load_state_dict
    .format(name))
KeyError: 'unexpected key "module.backbone.conv1.weight" in state_dict'

Does DataParallel make difference when loading pre-trained model?