Open LuoXubo opened 4 months ago
i solve this problem, If you're running this on a single GPU or CPU, you might encounter this. It seems the problem is due to a naming discrepancy between the model's keys (e.g., "face_landback.conv1.conv.weight") and the checkpoint's keys (which have "module." prefixed). Here's a quick snippet to help you out:
checkpoint = torch.load('path_to_your_checkpoint.pth') state_dict = checkpoint['state_dict'] for key in list(state_dict.keys()): if 'module.' in key: state_dict[key.replace('module.', '')] = state_dict.pop(key) model.load_state_dict(state_dict)
you can run this model with pre-train weights on mutil gpus or delete the 'model.' in the static_dict.
Hi!
Tanks for your great work. But there is a bug when I run this in terminal:
python main.py --data [MY_data_path] --evaluate checkpoint/affectnet-7-model_best.pth
The erros information is:
RuntimeError: Error(s) in loading state_dict for pyramid_trans_exper2: Missing key(s) in state_dict
It seems like the .pth file does not corresponds to the model used in main.py. How can I fix this bug?