加载模型的时候,加上一个关键字 strict model.load_state_dict(pretrained_dict, strict=False) # 多GPU训练,单GPU推理 strict=False