I get an RuntimeError: Error(s) in loading state_dict for DataParallel: I when I tried to load a model as follows;
model = ModelMark1()
model = torch.nn.DataParallel(model)
checkpoint = torch.load(checkpoint_path, map_location=device)
The details of error;
Unexpected key(s) in state_dict: "module.velocity_model.some_layer.gen_fc.linear.weight", "module.velocity_model.some_layer.gen_fc.linear.bias".
Here is the printed checkpoint dictionary;
odict_keys(['module.spectrogram_extractor.stft.conv_real.weight', 'module.spectrogram_extractor.stft.conv_imag.weight', 'module.logmel_extractor.melW', 'module.bn0.weight', 'module.bn0.bias', 'module.bn0.running_mean', 'module.bn0.running_var', 'module.bn0.num_batches_tracked', 'module.velocity_model.conv_block1.conv1.weight', 'module.velocity_model.conv_block1.conv2.weight', 'module.velocity_model.conv_block1.bn1.weight', 'module.velocity_model.conv_block1.bn1.bias', 'module.velocity_model.conv_block1.bn1.running_mean', 'module.velocity_model.conv_block1.bn1.running_var', 'module.velocity_model.conv_block1.bn1.num_batches_tracked', 'module.velocity_model.conv_block1.bn2.weight', 'module.velocity_model.conv_block1.bn2.bias', 'module.velocity_model.conv_block1.bn2.running_mean', 'module.velocity_model.conv_block1.bn2.running_var', 'module.velocity_model.conv_block1.bn2.num_batches_tracked', 'module.velocity_model.fc.weight', 'module.velocity_model.fc.bias', 'module.velocity_model.some_layer.gen_fc.linear.weight', 'module.velocity_model.some_layer.gen_fc.linear.bias'])
I am not too sure what are the problem here since the module.velocity_model. keys are loaded.
Also the model structure, names are not changed in ModelMark1.
Please let me know if you have advice/clue/solution on this issue.
Thank you so much for your help in advance!