torch多卡模型转单卡
作者:互联网
from collections import OrderedDict
state_dict1 = torch.load(self.model1)
module_state_dict1 = OrderedDict()
for k, v in state_dict1.items():
name = k[7:]
module_state_dict1[name] = v
self.model = self.model.cuda()
self.model.load_state_dict(module_state_dict1, strict=True)
#self.model = self.model.cuda()
self.model.eval()
标签:load,dict1,self,torch,多卡,module,state,model,单卡 来源: https://blog.csdn.net/caihuanqia/article/details/113711554