torch.load()加載模型,提示xxx.pt is a zip archive(did you mean to use torch.jit.load()?)


參考鏈接

https://blog.csdn.net/irober/article/details/115144522?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242

torch版本問題

import torch
state_dict = torch.load("./model_00050.pt")#加載原來的模型  在torch=1.6時加載
torch.save(state_dict, "./00050.pt", _use_new_zipfile_serialization=False)#不是zip 

再加載save后的模型即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM