头条网站怎么做的,在网站上放广告,网站seo优化8888,wordpress主题next推荐前段时间想自己部署一个ChatGLM来训练相关的物料当做chatgpt使用#xff0c;但是奈何没有gpu机器#xff0c;只能使用cpu服务器尝试使用看看效果 我部署的 Chinese-LangChain 这个项目#xff0c;使用的是LLM#xff08;ChatGLM#xff09;embedding(GanymedeNil/text2vec… 前段时间想自己部署一个ChatGLM来训练相关的物料当做chatgpt使用但是奈何没有gpu机器只能使用cpu服务器尝试使用看看效果 我部署的 Chinese-LangChain 这个项目使用的是LLMChatGLMembedding(GanymedeNil/text2vec-large-chinese)langChain的组合 一、环境 OSCentOS python3.9及以上 gcc CPU32核 内存128G 二、安装步骤 1、克隆源码
git clone https://github.com/THUDM/ChatGLM-6B.git 2、安装依赖
cd ChatGLM-6B
pip3 install -r requirements.txt 3、下载模型到本地
git lfs install
git clone https://huggingface.co/THUDM/chatglm-6b
GIT_LFS_SKIP_SMUDGE1 如果上面下载太慢也可以去https://huggingface.co/THUDM/chatglm-6b-int4/tree/main 手动下载然后上传到服务器上的指定目录下 4、修改代码支持cpu 找到web_demo.py脚本找到以下代码
tokenizer AutoTokenizer.from_pretrained(THUDM/chatglm-6b, trust_remote_codeTrue)
model AutoModel.from_pretrained(THUDM/chatglm-6b, trust_remote_codeTrue).half().cuda() 修改为
tokenizer AutoTokenizer.from_pretrained(**step3存放的路径**, trust_remote_codeTrue)
model AutoModel.from_pretrained(**step3存放的路径**, trust_remote_codeTrue).float() 模型的名字由THUDM/chatglm-6b改为 本地模型路径/chatglm-6b-int4 gpu模型源码中.half().cuda()替换为.float() 5、运行python web_demo.py 前台运行
python3 web_demo.py 后台运行
nohup python3 -u web_demo.py web_demo.out 21 6、运行成功直接在浏览器上打开服务器上提示的地址进行访问即可