LLM学习笔记(2)--本地部署ChatGLM3

目录

报错一:ValueError: The current `device_map` had weights offloaded to the disk. Please provide an `offload_folder` for them. Alternatively, make sure you have `safetensors` installed if the model you are using offers the weights in this format.

​编辑解决方法:(适用于gpu加载模型)

报错二:C:\Users\yali\.cache\huggingface\modules\transformers_modules\models\modeling_chatglm.py:226: UserWarning: 1Torch was not compiled with flash attention.

原因:

解决方法:不删除那个文件夹的数据就行。


 

配置来配置去,成功配置出一堆bug...

报错一:ValueError: The current `device_map` had weights offloaded to the disk. Please provide an `offload_folder` for them. Alternatively, make sure you have `safetensors` installed if the model you are using offers the weights in this format.

(ValueError:当前“device_map”已将权重卸载到磁盘。请为它们提供一个“offload_folder”。或者,如果您使用的模型提供这种格式的权重,请确保安装了“安全系数”。)

30b9bdb687f34e859435b2348f3343d4.png解决方法:(适用于gpu加载模型)

        将你想运行的相应模型的python文件的 device_map 参数的默认调用地址改为 “cuda” 即可解决(原本这个参数的默认值是“Auto”)

比如composite_demo中的client.py中

AutoModel.from_pretrained(MODEL_PATH, trust_remote_code=True, device_map="cuda").eval()

127c0c4d3de04ac69965939789b49117.png

 

报错二:C:\Users\yali\.cache\huggingface\modules\transformers_modules\models\modeling_chatglm.py:226: UserWarning: 1Torch was not compiled with flash attention.

(Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:555.)context_layer = torch.nn.functional.scaled_dot_product_attention(query_layer, key_layer, value_layer,

具体报错截图:

39b0bac489b54cdca16be696186a0660.png(pyCharm)4a7f9503d9464b54b95da9932813c702.png

(命令行)

原因:

第一次需要加载模型,地址在“C:\Users\用户名\.cache\huggingface”,这个删除之后就会报错

        经过看chatglm3文档后发现这是他必须要加载的模型

2e011796e80c42da877b91c1c9e76833.png

解决方法:不删除那个文件夹的数据就行。

最后放一张运行成功demo的截图:(ps:小白真难)

3470a9c9ca9a428cb45b318b3e5cdf25.png

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值