当前位置:   article > 正文

Runtime Error while Saving a PyTorch bin Model: “File /** Cannot Be Opened“

Runtime Error while Saving a PyTorch bin Model: “File /** Cannot Be Opened“

原始保存代码为:

quant_path = "baichuan2_awq"
torch.save(model.state_dict(), quant_path)
  • 1
  • 2

报错如下:

RuntimeError: File baichuan2_awq cannot be opened
  • 1

解决方法:需要保存的文件名字为"pytorch_model.bin"

import os
quant_path = "baichuan2_awq"
model_path = os.path.join(quant_path, "pytorch_model"+".bin")
torch.save(model.state_dict(), model_path)
  • 1
  • 2
  • 3
  • 4

问题解决
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/124064
推荐阅读
相关标签
  

闽ICP备14008679号