Pytorch加载model和optimizer&schedule时报错:
"loaded state dict contains a parameter group that doesn't match the"
检查方法:
def check():
pth_file_path = './net.pth' # model
state_dict = torch.load(pth_file_path)
print(len(state_dict['params']))
resume_state = torch.load('./m.state') # state
print(len(resume_state['optimizers'][0]['param_groups'][0]['params']))
看输出的这两个值是否相等。