pytorch 训练时错误size mismatch for module_list.88.Conv2d.weight: copying a param with shape torch.Size

Posted 九章_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pytorch 训练时错误size mismatch for module_list.88.Conv2d.weight: copying a param with shape torch.Size相关的知识,希望对你有一定的参考价值。

size mismatch for module_list.88.Conv2d.weight: copying a param with shape torch.Size([75, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 1024, 1, 1]).
size mismatch for module_list.88.Conv2d.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).

出现的错误,与解决方法
模型文件与模型配置文件不一致。比如长宽,输出的类别个数等等。使用模型时,一定要使用相应的参数。

以上是关于pytorch 训练时错误size mismatch for module_list.88.Conv2d.weight: copying a param with shape torch.Size的主要内容,如果未能解决你的问题,请参考以下文章

PyTorch+sklearn划分训练集/验证集

训练时 Pytorch CUDA OutOfMemory 错误

RuntimeError: Expected hidden[0] size (1, 1, 512), got (1, 128, 512) for LSTM pytorch

pytorch中使用多显卡训练以及训练时报错:expect more than 1 value per channel when training, got input size..

迁移学习调用预训练模型出现Given input size: (512x3x3). Calculated output size: (512x-3x-3)错误

Pytorch模型训练&保存/加载(搭建完整流程)