赞
踩
前几天跟着教程在自己电脑上部署了ChatGLM,总结一下整个过程
git lfs install
git clone https://huggingface.co/THUDM/chatglm-6b
conda create -n GML python= 3.10
pip install -r requirements.txt
transformers 和 protobuf 库下载
pip install protobuf==3.20.0 transformers==4.27.1 icetk cpm_kernels
因为要使用 Web 显示 所以也需要加载 gradio库
pip install gradio
chardet
pip install chardet
总之缺什么包就自己补什么
新建一个文件夹,命名为model
hugging face下载的内容放到该目录中
然后,web_demo.py中
修改为
tokenizer = AutoTokenizer.from_pretrained("model", trust_remote_code=True)
model = AutoModel.from_pretrained("model", trust_remote_code=True).half().quantize(8).cuda()
显存小的8改为4
运行该文件
成功
我的显存是16G,其实INT4 状态下只需要6G的显存,部署成本不高。效果尚可,在本地上跑成这样知足了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。