I am using the following code to load the model.
model.to(device)
checkpoint = torch.load("weights/vgg.pth")
if 'state_dict' in checkpoint:
checkpoint = checkpoint['state_dict']
ckpt = {k.replace('module.', ''):v for k,v in checkpoint.items()}
model.load_state_dict(ckpt)
I am getting the error:
self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for RepVGG: size mismatch for linear.weight: copying a param with shape torch.Size([1000, 1280]) from checkpoint, the shape in current model is torch.Size([8, 1280]). size mismatch for linear.bias: copying a param with shape torch.Size([1000]) from checkpoint, the shape in current model is torch.Size([8]).