Hi,
Could someone help me with this issue as I am unable to get this right.

Created a model like so
model = torchvision.models.resnet50(pretrained=True)

Inside for loop of each epoch , I have saved the state_dict like so

state = {'epoch': epoch + 1, 'state_dict': model.state_dict(),
             'optimizer': optimizer.state_dict() }
 torch.save(state, FILE_NAME)

After, a crash, I decided to load the model but unable to get a handle on how to load the model.
I did this:
model = torchvision.models.resnet50(pretrained=True)
checkpoint = torch.load(filename)
start_epoch = checkpoint['epoch']
model.load_state_dict(checkpoint['state_dict'])
optimizer.load_state_dict(checkpoint['optimizer'])

The Error I am getting is below:

RuntimeError: Error(s) in loading state_dict for ResNet:
	size mismatch for fc.weight: copying a param with shape torch.Size([18425, 2048]) from checkpoint, the shape in current model is torch.Size([1000, 2048]).
	size mismatch for fc.bias: copying a param with shape torch.Size([18425]) from checkpoint, the shape in current model is torch.Size([1000]).