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
sys.path.append('./vendors/Sphereface') config_path = os.path.join('./vendors', 'Sphereface', '20220428_232053', 'config.yml') with open(config_path, 'r') as f: test_config = yaml.load(f, yaml.SafeLoader)
bkb_net = build_from_cfg( test_config['model']['backbone']['net'], 'model.backbone', ) bkb_net.eval() checkpoint = os.path.join('./vendors', 'Sphereface', '20220428_232053', 'models', 'backbone_80000.pth') state_dict = torch.load(checkpoint, map_location=torch.device('cpu')) bkb_net.load_state_dict(state_dict) print(bkb_net)
Please help me.
Result: RuntimeError: Error(s) in loading state_dict for SFNet_deprecated: Missing key(s) in state_dict: "layer1.0.conv1.weight", "layer1.0.conv1.bias", "layer1.1.conv1.weight", "layer1.1.conv1.bias", "layer1.1.conv2.weight", "layer1.1.conv2.bias", "layer2.0.conv1.weight", "layer2.0.conv1.bias", "layer2.1.conv1.weight", "layer2.1.conv1.bias", "layer2.1.conv2.weight", "layer2.1.conv2.bias", "layer2.2.conv1.weight", "layer2.2.conv1.bias", "layer2.2.conv2.weight", "layer2.2.conv2.bias", "layer3.0.conv1.weight", "layer3.0.conv1.bias", "layer3.1.conv1.weight", "layer3.1.conv1.bias", "layer3.1.conv2.weight", "layer3.1.conv2.bias", "layer3.2.conv1.weight", "layer3.2.conv1.bias", "layer3.2.conv2.weight", "layer3.2.conv2.bias", "layer3.3.conv1.weight", "layer3.3.conv1.bias", "layer3.3.conv2.weight", "layer3.3.conv2.bias", "layer3.4.conv1.weight", "layer3.4.conv1.bias", "layer3.4.conv2.weight", "layer3.4.conv2.bias", "layer4.0.conv1.weight", "layer4.0.conv1.bias", "layer4.1.conv1.weight", "layer4.1.conv1.bias", "layer4.1.conv2.weight", "layer4.1.conv2.bias", "fc.weight", "fc.bias". Unexpected key(s) in state_dict: "module.layer1.0.conv1.weight", "module.layer1.0.conv1.bias", "module.layer1.1.conv1.weight", "module.layer1.1.conv1.bias", "module.layer1.1.conv2.weight", "module.layer1.1.conv2.bias", "module.layer2.0.conv1.weight", "module.layer2.0.conv1.bias", "module.layer2.1.conv1.weight", "module.layer2.1.conv1.bias", "module.layer2.1.conv2.weight", "module.layer2.1.conv2.bias", "module.layer2.2.conv1.weight", "module.layer2.2.conv1.bias", "module.layer2.2.conv2.weight", "module.layer2.2.conv2.bias", "module.layer3.0.conv1.weight", "module.layer3.0.conv1.bias", "module.layer3.1.conv1.weight", "module.layer3.1.conv1.bias", "module.layer3.1.conv2.weight", "module.layer3.1.conv2.bias", "module.layer3.2.conv1.weight", "module.layer3.2.conv1.bias", "module.layer3.2.conv2.weight", "module.layer3.2.conv2.bias", "module.layer3.3.conv1.weight", "module.layer3.3.conv1.bias", "module.layer3.3.conv2.weight", "module.layer3.3.conv2.bias", "module.layer3.4.conv1.weight", "module.layer3.4.conv1.bias", "module.layer3.4.conv2.weight", "module.layer3.4.conv2.bias", "module.layer4.0.conv1.weight", "module.layer4.0.conv1.bias", "module.layer4.1.conv1.weight", "module.layer4.1.conv1.bias", "module.layer4.1.conv2.weight", "module.layer4.1.conv2.bias", "module.fc.weight", "module.fc.bias".
The text was updated successfully, but these errors were encountered:
Hey microvnn,
You can try wrapping the model to DDP before loading the parameters.
example: ddp_model = DDP(model, device_ids=[rank])
Sorry, something went wrong.
No branches or pull requests
sys.path.append('./vendors/Sphereface')
config_path = os.path.join('./vendors', 'Sphereface',
'20220428_232053', 'config.yml')
with open(config_path, 'r') as f:
test_config = yaml.load(f, yaml.SafeLoader)
build model
bkb_net = build_from_cfg(
test_config['model']['backbone']['net'],
'model.backbone',
)
bkb_net.eval()
checkpoint = os.path.join('./vendors', 'Sphereface',
'20220428_232053', 'models', 'backbone_80000.pth')
state_dict = torch.load(checkpoint, map_location=torch.device('cpu'))
bkb_net.load_state_dict(state_dict)
print(bkb_net)
Please help me.
Result:
RuntimeError: Error(s) in loading state_dict for SFNet_deprecated:
Missing key(s) in state_dict: "layer1.0.conv1.weight", "layer1.0.conv1.bias", "layer1.1.conv1.weight", "layer1.1.conv1.bias", "layer1.1.conv2.weight", "layer1.1.conv2.bias", "layer2.0.conv1.weight", "layer2.0.conv1.bias", "layer2.1.conv1.weight", "layer2.1.conv1.bias", "layer2.1.conv2.weight", "layer2.1.conv2.bias", "layer2.2.conv1.weight", "layer2.2.conv1.bias", "layer2.2.conv2.weight", "layer2.2.conv2.bias", "layer3.0.conv1.weight", "layer3.0.conv1.bias", "layer3.1.conv1.weight", "layer3.1.conv1.bias", "layer3.1.conv2.weight", "layer3.1.conv2.bias", "layer3.2.conv1.weight", "layer3.2.conv1.bias", "layer3.2.conv2.weight", "layer3.2.conv2.bias", "layer3.3.conv1.weight", "layer3.3.conv1.bias", "layer3.3.conv2.weight", "layer3.3.conv2.bias", "layer3.4.conv1.weight", "layer3.4.conv1.bias", "layer3.4.conv2.weight", "layer3.4.conv2.bias", "layer4.0.conv1.weight", "layer4.0.conv1.bias", "layer4.1.conv1.weight", "layer4.1.conv1.bias", "layer4.1.conv2.weight", "layer4.1.conv2.bias", "fc.weight", "fc.bias".
Unexpected key(s) in state_dict: "module.layer1.0.conv1.weight", "module.layer1.0.conv1.bias", "module.layer1.1.conv1.weight", "module.layer1.1.conv1.bias", "module.layer1.1.conv2.weight", "module.layer1.1.conv2.bias", "module.layer2.0.conv1.weight", "module.layer2.0.conv1.bias", "module.layer2.1.conv1.weight", "module.layer2.1.conv1.bias", "module.layer2.1.conv2.weight", "module.layer2.1.conv2.bias", "module.layer2.2.conv1.weight", "module.layer2.2.conv1.bias", "module.layer2.2.conv2.weight", "module.layer2.2.conv2.bias", "module.layer3.0.conv1.weight", "module.layer3.0.conv1.bias", "module.layer3.1.conv1.weight", "module.layer3.1.conv1.bias", "module.layer3.1.conv2.weight", "module.layer3.1.conv2.bias", "module.layer3.2.conv1.weight", "module.layer3.2.conv1.bias", "module.layer3.2.conv2.weight", "module.layer3.2.conv2.bias", "module.layer3.3.conv1.weight", "module.layer3.3.conv1.bias", "module.layer3.3.conv2.weight", "module.layer3.3.conv2.bias", "module.layer3.4.conv1.weight", "module.layer3.4.conv1.bias", "module.layer3.4.conv2.weight", "module.layer3.4.conv2.bias", "module.layer4.0.conv1.weight", "module.layer4.0.conv1.bias", "module.layer4.1.conv1.weight", "module.layer4.1.conv1.bias", "module.layer4.1.conv2.weight", "module.layer4.1.conv2.bias",
"module.fc.weight", "module.fc.bias".
The text was updated successfully, but these errors were encountered: