Open ShafinH opened 2 years ago
File "train.py", line 266, in <module> main() File "train.py", line 151, in main args.reload_path, map_location=torch.device('cpu'))) File "C:\Users\shafi\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 1407, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for unet3D: Missing key(s) in state_dict: "conv1.weight", "layer0.0.gn1.weight", "layer0.0.gn1.bias", "layer0.0.conv1.weight", "layer0.0.gn2.weight", "layer0.0.gn2.bias", "layer0.0.conv2.weight", "layer1.0.gn1.weight", "layer1.0.gn1.bias", "layer1.0.conv1.weight", "layer1.0.gn2.weight", "layer1.0.gn2.bias", "layer1.0.conv2.weight", "layer1.0.downsample.0.weight", "layer1.0.downsample.0.bias", "layer1.0.downsample.2.weight", "layer1.1.gn1.weight", "layer1.1.gn1.bias", "layer1.1.conv1.weight", "layer1.1.gn2.weight", "layer1.1.gn2.bias", "layer1.1.conv2.weight", "layer2.0.gn1.weight", "layer2.0.gn1.bias", "layer2.0.conv1.weight", "layer2.0.gn2.weight", "layer2.0.gn2.bias", "layer2.0.conv2.weight", "layer2.0.downsample.0.weight", "layer2.0.downsample.0.bias", "layer2.0.downsample.2.weight", "layer2.1.gn1.weight", "layer2.1.gn1.bias", "layer2.1.conv1.weight", "layer2.1.gn2.weight", "layer2.1.gn2.bias", "layer2.1.conv2.weight", "layer3.0.gn1.weight", "layer3.0.gn1.bias", "layer3.0.conv1.weight", "layer3.0.gn2.weight", "layer3.0.gn2.bias", "layer3.0.conv2.weight", "layer3.0.downsample.0.weight", "layer3.0.downsample.0.bias", "layer3.0.downsample.2.weight", "layer3.1.gn1.weight", "layer3.1.gn1.bias", "layer3.1.conv1.weight", "layer3.1.gn2.weight", "layer3.1.gn2.bias", "layer3.1.conv2.weight", "layer4.0.gn1.weight", "layer4.0.gn1.bias", "layer4.0.conv1.weight", "layer4.0.gn2.weight", "layer4.0.gn2.bias", "layer4.0.conv2.weight", "layer4.0.downsample.0.weight", "layer4.0.downsample.0.bias", "layer4.0.downsample.2.weight", "layer4.1.gn1.weight", "layer4.1.gn1.bias", "layer4.1.conv1.weight", "layer4.1.gn2.weight", "layer4.1.gn2.bias", "layer4.1.conv2.weight", "fusionConv.0.weight", "fusionConv.0.bias", "fusionConv.2.weight", "x8_resb.0.gn1.weight", "x8_resb.0.gn1.bias", "x8_resb.0.conv1.weight", "x8_resb.0.gn2.weight", "x8_resb.0.gn2.bias", "x8_resb.0.conv2.weight", "x8_resb.0.downsample.0.weight", "x8_resb.0.downsample.0.bias", "x8_resb.0.downsample.2.weight", "x4_resb.0.gn1.weight", "x4_resb.0.gn1.bias", "x4_resb.0.conv1.weight", "x4_resb.0.gn2.weight", "x4_resb.0.gn2.bias", "x4_resb.0.conv2.weight", "x4_resb.0.downsample.0.weight", "x4_resb.0.downsample.0.bias", "x4_resb.0.downsample.2.weight", "x2_resb.0.gn1.weight", "x2_resb.0.gn1.bias", "x2_resb.0.conv1.weight", "x2_resb.0.gn2.weight", "x2_resb.0.gn2.bias", "x2_resb.0.conv2.weight", "x2_resb.0.downsample.0.weight", "x2_resb.0.downsample.0.bias", "x2_resb.0.downsample.2.weight", "x1_resb.0.gn1.weight", "x1_resb.0.gn1.bias", "x1_resb.0.conv1.weight", "x1_resb.0.gn2.weight", "x1_resb.0.gn2.bias", "x1_resb.0.conv2.weight", "precls_conv.0.weight", "precls_conv.0.bias", "precls_conv.2.weight", "precls_conv.2.bias", "GAP.0.weight", "GAP.0.bias", "controller.weight", "controller.bias". Unexpected key(s) in state_dict: "module.conv1.weight", "module.layer0.0.gn1.weight", "module.layer0.0.gn1.bias", "module.layer0.0.conv1.weight", "module.layer0.0.gn2.weight", "module.layer0.0.gn2.bias", "module.layer0.0.conv2.weight", "module.layer1.0.gn1.weight", "module.layer1.0.gn1.bias", "module.layer1.0.conv1.weight", "module.layer1.0.gn2.weight", "module.layer1.0.gn2.bias", "module.layer1.0.conv2.weight", "module.layer1.0.downsample.0.weight", "module.layer1.0.downsample.0.bias", "module.layer1.0.downsample.2.weight", "module.layer1.1.gn1.weight", "module.layer1.1.gn1.bias", "module.layer1.1.conv1.weight", "module.layer1.1.gn2.weight", "module.layer1.1.gn2.bias", "module.layer1.1.conv2.weight", "module.layer2.0.gn1.weight", "module.layer2.0.gn1.bias", "module.layer2.0.conv1.weight", "module.layer2.0.gn2.weight", "module.layer2.0.gn2.bias", "module.layer2.0.conv2.weight", "module.layer2.0.downsample.0.weight", "module.layer2.0.downsample.0.bias", "module.layer2.0.downsample.2.weight", "module.layer2.1.gn1.weight", "module.layer2.1.gn1.bias", "module.layer2.1.conv1.weight", "module.layer2.1.gn2.weight", "module.layer2.1.gn2.bias", "module.layer2.1.conv2.weight", "module.layer3.0.gn1.weight", "module.layer3.0.gn1.bias", "module.layer3.0.conv1.weight", "module.layer3.0.gn2.weight", "module.layer3.0.gn2.bias", "module.layer3.0.conv2.weight", "module.layer3.0.downsample.0.weight", "module.layer3.0.downsample.0.bias", "module.layer3.0.downsample.2.weight", "module.layer3.1.gn1.weight", "module.layer3.1.gn1.bias", "module.layer3.1.conv1.weight", "module.layer3.1.gn2.weight", "module.layer3.1.gn2.bias", "module.layer3.1.conv2.weight", "module.layer4.0.gn1.weight", "module.layer4.0.gn1.bias", "module.layer4.0.conv1.weight", "module.layer4.0.gn2.weight", "module.layer4.0.gn2.bias", "module.layer4.0.conv2.weight", "module.layer4.0.downsample.0.weight", "module.layer4.0.downsample.0.bias", "module.layer4.0.downsample.2.weight", "module.layer4.1.gn1.weight", "module.layer4.1.gn1.bias", "module.layer4.1.conv1.weight", "module.layer4.1.gn2.weight", "module.layer4.1.gn2.bias", "module.layer4.1.conv2.weight", "module.fusionConv.0.weight", "module.fusionConv.0.bias", "module.fusionConv.2.weight", "module.x8_resb.0.gn1.weight", "module.x8_resb.0.gn1.bias", "module.x8_resb.0.conv1.weight", "module.x8_resb.0.gn2.weight", "module.x8_resb.0.gn2.bias", "module.x8_resb.0.conv2.weight", "module.x8_resb.0.downsample.0.weight", "module.x8_resb.0.downsample.0.bias", "module.x8_resb.0.downsample.2.weight", "module.x4_resb.0.gn1.weight", "module.x4_resb.0.gn1.bias", "module.x4_resb.0.conv1.weight", "module.x4_resb.0.gn2.weight", "module.x4_resb.0.gn2.bias", "module.x4_resb.0.conv2.weight", "module.x4_resb.0.downsample.0.weight", "module.x4_resb.0.downsample.0.bias", "module.x4_resb.0.downsample.2.weight", "module.x2_resb.0.gn1.weight", "module.x2_resb.0.gn1.bias", "module.x2_resb.0.conv1.weight", "module.x2_resb.0.gn2.weight", "module.x2_resb.0.gn2.bias", "module.x2_resb.0.conv2.weight", "module.x2_resb.0.downsample.0.weight", "module.x2_resb.0.downsample.0.bias", "module.x2_resb.0.downsample.2.weight", "module.x1_resb.0.gn1.weight", "module.x1_resb.0.gn1.bias", "module.x1_resb.0.conv1.weight", "module.x1_resb.0.gn2.weight", "module.x1_resb.0.gn2.bias", "module.x1_resb.0.conv2.weight", "module.precls_conv.0.weight", "module.precls_conv.0.bias", "module.precls_conv.2.weight", "module.precls_conv.2.bias", "module.GAP.0.weight", "module.GAP.0.bias", "module.controller.weight", "module.controller.bias".
This error is: the GPU model runs on the CPU, so if you run on the GPU, no error is reported
But the original code loads it on the CPU so shouldn't that be right?
File "train.py", line 266, in <module> main() File "train.py", line 151, in main args.reload_path, map_location=torch.device('cpu'))) File "C:\Users\shafi\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 1407, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for unet3D: Missing key(s) in state_dict: "conv1.weight", "layer0.0.gn1.weight", "layer0.0.gn1.bias", "layer0.0.conv1.weight", "layer0.0.gn2.weight", "layer0.0.gn2.bias", "layer0.0.conv2.weight", "layer1.0.gn1.weight", "layer1.0.gn1.bias", "layer1.0.conv1.weight", "layer1.0.gn2.weight", "layer1.0.gn2.bias", "layer1.0.conv2.weight", "layer1.0.downsample.0.weight", "layer1.0.downsample.0.bias", "layer1.0.downsample.2.weight", "layer1.1.gn1.weight", "layer1.1.gn1.bias", "layer1.1.conv1.weight", "layer1.1.gn2.weight", "layer1.1.gn2.bias", "layer1.1.conv2.weight", "layer2.0.gn1.weight", "layer2.0.gn1.bias", "layer2.0.conv1.weight", "layer2.0.gn2.weight", "layer2.0.gn2.bias", "layer2.0.conv2.weight", "layer2.0.downsample.0.weight", "layer2.0.downsample.0.bias", "layer2.0.downsample.2.weight", "layer2.1.gn1.weight", "layer2.1.gn1.bias", "layer2.1.conv1.weight", "layer2.1.gn2.weight", "layer2.1.gn2.bias", "layer2.1.conv2.weight", "layer3.0.gn1.weight", "layer3.0.gn1.bias", "layer3.0.conv1.weight", "layer3.0.gn2.weight", "layer3.0.gn2.bias", "layer3.0.conv2.weight", "layer3.0.downsample.0.weight", "layer3.0.downsample.0.bias", "layer3.0.downsample.2.weight", "layer3.1.gn1.weight", "layer3.1.gn1.bias", "layer3.1.conv1.weight", "layer3.1.gn2.weight", "layer3.1.gn2.bias", "layer3.1.conv2.weight", "layer4.0.gn1.weight", "layer4.0.gn1.bias", "layer4.0.conv1.weight", "layer4.0.gn2.weight", "layer4.0.gn2.bias", "layer4.0.conv2.weight", "layer4.0.downsample.0.weight", "layer4.0.downsample.0.bias", "layer4.0.downsample.2.weight", "layer4.1.gn1.weight", "layer4.1.gn1.bias", "layer4.1.conv1.weight", "layer4.1.gn2.weight", "layer4.1.gn2.bias", "layer4.1.conv2.weight", "fusionConv.0.weight", "fusionConv.0.bias", "fusionConv.2.weight", "x8_resb.0.gn1.weight", "x8_resb.0.gn1.bias", "x8_resb.0.conv1.weight", "x8_resb.0.gn2.weight", "x8_resb.0.gn2.bias", "x8_resb.0.conv2.weight", "x8_resb.0.downsample.0.weight", "x8_resb.0.downsample.0.bias", "x8_resb.0.downsample.2.weight", "x4_resb.0.gn1.weight", "x4_resb.0.gn1.bias", "x4_resb.0.conv1.weight", "x4_resb.0.gn2.weight", "x4_resb.0.gn2.bias", "x4_resb.0.conv2.weight", "x4_resb.0.downsample.0.weight", "x4_resb.0.downsample.0.bias", "x4_resb.0.downsample.2.weight", "x2_resb.0.gn1.weight", "x2_resb.0.gn1.bias", "x2_resb.0.conv1.weight", "x2_resb.0.gn2.weight", "x2_resb.0.gn2.bias", "x2_resb.0.conv2.weight", "x2_resb.0.downsample.0.weight", "x2_resb.0.downsample.0.bias", "x2_resb.0.downsample.2.weight", "x1_resb.0.gn1.weight", "x1_resb.0.gn1.bias", "x1_resb.0.conv1.weight", "x1_resb.0.gn2.weight", "x1_resb.0.gn2.bias", "x1_resb.0.conv2.weight", "precls_conv.0.weight", "precls_conv.0.bias", "precls_conv.2.weight", "precls_conv.2.bias", "GAP.0.weight", "GAP.0.bias", "controller.weight", "controller.bias". Unexpected key(s) in state_dict: "module.conv1.weight", "module.layer0.0.gn1.weight", "module.layer0.0.gn1.bias", "module.layer0.0.conv1.weight", "module.layer0.0.gn2.weight", "module.layer0.0.gn2.bias", "module.layer0.0.conv2.weight", "module.layer1.0.gn1.weight", "module.layer1.0.gn1.bias", "module.layer1.0.conv1.weight", "module.layer1.0.gn2.weight", "module.layer1.0.gn2.bias", "module.layer1.0.conv2.weight", "module.layer1.0.downsample.0.weight", "module.layer1.0.downsample.0.bias", "module.layer1.0.downsample.2.weight", "module.layer1.1.gn1.weight", "module.layer1.1.gn1.bias", "module.layer1.1.conv1.weight", "module.layer1.1.gn2.weight", "module.layer1.1.gn2.bias", "module.layer1.1.conv2.weight", "module.layer2.0.gn1.weight", "module.layer2.0.gn1.bias", "module.layer2.0.conv1.weight", "module.layer2.0.gn2.weight", "module.layer2.0.gn2.bias", "module.layer2.0.conv2.weight", "module.layer2.0.downsample.0.weight", "module.layer2.0.downsample.0.bias", "module.layer2.0.downsample.2.weight", "module.layer2.1.gn1.weight", "module.layer2.1.gn1.bias", "module.layer2.1.conv1.weight", "module.layer2.1.gn2.weight", "module.layer2.1.gn2.bias", "module.layer2.1.conv2.weight", "module.layer3.0.gn1.weight", "module.layer3.0.gn1.bias", "module.layer3.0.conv1.weight", "module.layer3.0.gn2.weight", "module.layer3.0.gn2.bias", "module.layer3.0.conv2.weight", "module.layer3.0.downsample.0.weight", "module.layer3.0.downsample.0.bias", "module.layer3.0.downsample.2.weight", "module.layer3.1.gn1.weight", "module.layer3.1.gn1.bias", "module.layer3.1.conv1.weight", "module.layer3.1.gn2.weight", "module.layer3.1.gn2.bias", "module.layer3.1.conv2.weight", "module.layer4.0.gn1.weight", "module.layer4.0.gn1.bias", "module.layer4.0.conv1.weight", "module.layer4.0.gn2.weight", "module.layer4.0.gn2.bias", "module.layer4.0.conv2.weight", "module.layer4.0.downsample.0.weight", "module.layer4.0.downsample.0.bias", "module.layer4.0.downsample.2.weight", "module.layer4.1.gn1.weight", "module.layer4.1.gn1.bias", "module.layer4.1.conv1.weight", "module.layer4.1.gn2.weight", "module.layer4.1.gn2.bias", "module.layer4.1.conv2.weight", "module.fusionConv.0.weight", "module.fusionConv.0.bias", "module.fusionConv.2.weight", "module.x8_resb.0.gn1.weight", "module.x8_resb.0.gn1.bias", "module.x8_resb.0.conv1.weight", "module.x8_resb.0.gn2.weight", "module.x8_resb.0.gn2.bias", "module.x8_resb.0.conv2.weight", "module.x8_resb.0.downsample.0.weight", "module.x8_resb.0.downsample.0.bias", "module.x8_resb.0.downsample.2.weight", "module.x4_resb.0.gn1.weight", "module.x4_resb.0.gn1.bias", "module.x4_resb.0.conv1.weight", "module.x4_resb.0.gn2.weight", "module.x4_resb.0.gn2.bias", "module.x4_resb.0.conv2.weight", "module.x4_resb.0.downsample.0.weight", "module.x4_resb.0.downsample.0.bias", "module.x4_resb.0.downsample.2.weight", "module.x2_resb.0.gn1.weight", "module.x2_resb.0.gn1.bias", "module.x2_resb.0.conv1.weight", "module.x2_resb.0.gn2.weight", "module.x2_resb.0.gn2.bias", "module.x2_resb.0.conv2.weight", "module.x2_resb.0.downsample.0.weight", "module.x2_resb.0.downsample.0.bias", "module.x2_resb.0.downsample.2.weight", "module.x1_resb.0.gn1.weight", "module.x1_resb.0.gn1.bias", "module.x1_resb.0.conv1.weight", "module.x1_resb.0.gn2.weight", "module.x1_resb.0.gn2.bias", "module.x1_resb.0.conv2.weight", "module.precls_conv.0.weight", "module.precls_conv.0.bias", "module.precls_conv.2.weight", "module.precls_conv.2.bias", "module.GAP.0.weight", "module.GAP.0.bias", "module.controller.weight", "module.controller.bias".