[BEFORE]
net = nn.DataParallel(net).cuda()
torch.save(net, save_folder + '/' + 'net.pt')
net = nn.DataParallel(torch.load(save_folder + '/net.pt'), device_ids=[0]).to(device)
[AFTER]
torch.save(net.module.state_dict(), 'net.pt')
net.module.load_state_dict(torch.load('/net.pt'), strict=False)
I saved the saved model with [BEFORE] codes.
Now I’ve changed codes from [BEFORE] to [AFTER]. Because I figured out there are some problems with [BEFORE] codes when I loaded the model with DataParallel.
But I have to use the trained model that saved with [BEFORE] codes. How can I load ?
If I trained the model with gpu_id:{2,3}, then should I load this model with {2,3} ?