当前位置:   article > 正文

pytorch错误解决: Missing key(s) in state_dict: Unexpected key(s) in state_dict:_missing key(s) in state_dict: "pam.alpha", "pam.co

missing key(s) in state_dict: "pam.alpha", "pam.conv_b.weight", "pam.conv_b.

pytorch错误解决:
Missing key(s) in state_dict:

Unexpected key(s) in state_dict:

解决:

在模型参数被加载到模型前加下面的语句:

model = nn.DataParallel(model)

#cudnn.benchmark = True

model.load_state_dict(pth,False)
且在加载模型中添加一个False

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/160105
推荐阅读
相关标签
  

闽ICP备14008679号