我是靠谱客的博主 稳重白羊,这篇文章主要介绍RuntimeError: mat1 dim 1 must match mat2 dim 0以及local variable ‘beta1‘ referenced before assignment报错1:,现在分享给大家,希望可以做个参考。
使用voc格式数据集训练poolformer 时两个报
报错1:
return torch._C._nn.linear(input, weight, bias)
RuntimeError: mat1 dim 1 must match mat2 dim 0
解决办法是模型的in_channels要与模型本身匹配,我开始使用的是2048,就报这个错了,改成768后就正常了

报错2:
由于使用的优化器是adamw,查了资料后发现,是pytorch代码bug导致的,github上已经修复
local variable ‘beta1‘ referenced before assignment
将pytorch 的代码按照github上的对应代码文件修改一下即可
[optim] bugfix when all parameters have no grad by wanchaol · Pull Request #52944 · pytorch/pytorch · GitHub
总共涉及三个文件:

最后
以上就是稳重白羊最近收集整理的关于RuntimeError: mat1 dim 1 must match mat2 dim 0以及local variable ‘beta1‘ referenced before assignment报错1:的全部内容,更多相关RuntimeError:内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复