As a project, we created and trained an Alexnet model to train with CIFAR-10.
Our next project is to conduct transfer learning with the model we trained using CIFAR-10.
Problem is, the dataset we are using for transfer learning requires 100 output nodes.
Therefore, if we define a model with 100 output nodes and try to load parameters from previous model, error occurs as below.
Error(s) in loading state_dict for AlexNet2:
size mismatch for fc.4.weight: copying a param with shape torch.Size([10, 4096]) from checkpoint, the shape in current model is torch.Size([100, 4096]).
size mismatch for fc.4.bias: copying a param with shape torch.Size() from checkpoint, the shape in current model is torch.Size().
How should I deal with this problem?
I’m guessing I should only save and load parameters excluding the last layer but not sure about it.