I have applied a pruning method in which the number of channels are reduced in the model. I would like to know if it would be possible to load this checkpoint into a model without a size mismathc error.
Since the model before pruning had 256 channels, 512 channels, etc in each layer (VGG), and the pruned VGG model has 188 and 313 channels, I am getting a size mismatch error when I run:
model.load_state_dict(checkpoint[‘model_state_dict’])
Here’s the error:
size mismatch for feature.50.running_var: copying a param with shape torch.Size([313]) from checkpoint, the shape in current model is torch.Size([512])
How do I save the new pruned checkpoint into another model?