问题描述
torchfile.load() 加载torch权重报错
torch_model = torchfile.load(torch_weights_file)
原因分析:
一开始以为是python、numpy版本问题,试了很多版本都不行
后面发现是不同系统的影响
预训练的torch权重是在非PC上生成的,在PC上加载它就会报错(不同系统的数据差异)
解决方案:
强制8位
torch_model = torchfile.load(torch_weights_file, force_8bytes_long=True)
参考:
https://www.zhihu.com/question/68576658/answer/814335412