We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好,我在使用g_ghost_regnetx_032作为特征提取网络训练自己的分类任务时,我想加载预训练模型g_ghost_regnet_3.2g_77.8.pth,使用到的代码如下:
import torch from models.g_ghost_renet import g_ghost_regnetx_032 model = g_ghost_regnetx_032() model.load_state_dict(torch.load('./weights/g_ghost_regnet_3.2g_77.8.pth')) print(model)
出现了如下报错: RuntimeError: Error(s) in loading state_dict for GGhostRegNet: Missing key(s) in state_dict: "conv1.weight", "bn1.weight", "bn1.bias", "bn1.running_mean", "bn1.running_var", "layer1.0.conv1.weight", "layer1.0.bn1.weight", "layer1.0.bn1.bias", "layer1.0.bn1.running_mean", "layer1.0.bn1.running_var", 。。。。。 Unexpected key(s) in state_dict: "module.conv1.weight", "module.bn1.weight", "module.bn1.bias", "module.bn1.running_mean", "module.bn1.
请问这是不是因为pytorch版本不匹配的问题,我需要如何才能使用到预训练模型呢,期待您的回复!
The text was updated successfully, but these errors were encountered:
改成state_dict['module']
Sorry, something went wrong.
No branches or pull requests
您好,我在使用g_ghost_regnetx_032作为特征提取网络训练自己的分类任务时,我想加载预训练模型g_ghost_regnet_3.2g_77.8.pth,使用到的代码如下:
import torch
from models.g_ghost_renet import g_ghost_regnetx_032
model = g_ghost_regnetx_032()
model.load_state_dict(torch.load('./weights/g_ghost_regnet_3.2g_77.8.pth'))
print(model)
出现了如下报错:
RuntimeError: Error(s) in loading state_dict for GGhostRegNet:
Missing key(s) in state_dict: "conv1.weight", "bn1.weight", "bn1.bias", "bn1.running_mean", "bn1.running_var", "layer1.0.conv1.weight", "layer1.0.bn1.weight", "layer1.0.bn1.bias", "layer1.0.bn1.running_mean", "layer1.0.bn1.running_var", 。。。。。
Unexpected key(s) in state_dict: "module.conv1.weight", "module.bn1.weight", "module.bn1.bias", "module.bn1.running_mean", "module.bn1.
请问这是不是因为pytorch版本不匹配的问题,我需要如何才能使用到预训练模型呢,期待您的回复!
The text was updated successfully, but these errors were encountered: