I’m training a pruned yolov3 using eriklindernoren’s implement.
I used prune.random_unstructured
to prune the layers and saved them with the code torch.save(model.state_dict(), opt.save_path_p)
.
However, when I try to load them with model.load_state_dict(torch.load(opt.pretrained_weights))
, it returns an error saying that
Missing key(s) in state_dict: "module_list.#.conv_#.weight"
Unexpected key(s) in state_dict: "module_list.#.conv_#.weight_orig", "module_list.#.conv_#.weight_mask",
. (# is the number)
I searched about it but couldn’t get how to solve it. Someone said that I can change it using weight=weight_orig * weight_mask but I can’t understand why and how to do it.
If anyone can help, I would really appreciate it.