I have a problem in loading the pretrained model.
This is my code:
model = CURLNet()checkpoint = torch.load(weights, map_location=torch.device('cuda'))model.load_state_dict(checkpoint['model_state_dict'], strict=False)model.eval()
In line 3 I got the following error.
RuntimeError: Error(s) in loading state_dict for CURLNet: size mismatch for tednet.ted.dconv_down1.conv1.weight: copying a param with shape torch.Size([16, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 4, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv1.weight: copying a param with shape torch.Size([3, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 32, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv1.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for tednet.ted.dconv_up1.conv2.weight: copying a param with shape torch.Size([3, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 16, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv2.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for tednet.final_conv.weight: copying a param with shape torch.Size([64, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 16, 3, 3]).
It looks like the weights and the architecture are not the same. The pretrained model which I used was:
curl_validpsnr_23.073045286204017_validloss_0.0701291635632515_testpsnr_23.584083321292365_testloss_0.061363041400909424_epoch_510_model.pt
I have a problem in loading the pretrained model. This is my code:
model = CURLNet()
checkpoint = torch.load(weights, map_location=torch.device('cuda'))
model.load_state_dict(checkpoint['model_state_dict'], strict=False)
model.eval()
In line 3 I got the following error.
RuntimeError: Error(s) in loading state_dict for CURLNet: size mismatch for tednet.ted.dconv_down1.conv1.weight: copying a param with shape torch.Size([16, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 4, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv1.weight: copying a param with shape torch.Size([3, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 32, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv1.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for tednet.ted.dconv_up1.conv2.weight: copying a param with shape torch.Size([3, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 16, 3, 3]). size mismatch for tednet.ted.dconv_up1.conv2.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for tednet.final_conv.weight: copying a param with shape torch.Size([64, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 16, 3, 3]).
It looks like the weights and the architecture are not the same. The pretrained model which I used was: curl_validpsnr_23.073045286204017_validloss_0.0701291635632515_testpsnr_23.584083321292365_testloss_0.061363041400909424_epoch_510_model.pt
What should I do?