且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试使用 torch.load(PATH) 加载预训练模型时出现 unicode 解码错误

更新时间:2022-05-17 10:51:35

每当模型在 Torch 版本 < 上进行预训练时,就会出现此错误.0.4 但使用火炬版本 >0.4 用于测试/恢复.
所以使用 checkpoint = torch.load(args.resume,encoding='latin1')

This error hits whenever the model is pretrained on torch version < 0.4 but using torch version > 0.4 for testing / resuming.
so use checkpoint = torch.load(args.resume,encoding='latin1')