Bug:
model_state_dict = {
key.replace('module.', ''): tmp[key] for key in tmp if
(('SearchNet' not in key) and ('_copy' not in key))
}
model_name = self.args.save_dir.strip('/')+'/model/model_latest.pth'
torch.save(model_state_dict, model_name)
Torch.save FileNotFoundError: [Errno 2] No such file or directory
解决方法:
原先代码中default设置的路径是绝对路径,现在改为相对路径没有报错
parser.add_argument('--save_dir', type=str, default='./log/',
help='Directory to save log, arguments, models and images')