ChatGLM-6B安装笔记

《ChatGLM-6B安装笔记》

安装ChatGLM-6B(python3.7必须)

python3.7的安装可以查看这里

官网地址:https://github.com/THUDM/ChatGLM-6B

/usr/local/ChatGLM-6B


1.复制项目:git clone https://huggingface.co/THUDM/chatglm-6b
2.下载模块(从本地加载模型) ,需要全部下载,约20个文件
   源地址:https://huggingface.co/THUDM/chatglm-6b/tree/main (慢)
   清华地址:https://cloud.tsinghua.edu.cn/d/fb9f16d6dc8f482596c2/ (快)
3.在项目根目录新建一个文件夹,文件夹命名为chatglm-6b,将下载好的放到这个目录内

4.安装python环境 测试笔记中,最低环境需要python3.7.0
  安装python3.7后 ,  执行:pip3.7 install -r requirements.txt

5.网页服务端依赖
pip3.7 install gradio
 
6.进行项目根目录(必须)运行 : 
python3.7 web_demo.py

安装ChatGLM2-6B(python3.9必须)

python3.9的安装可以查看这里


官网地址:https://github.com/THUDM/ChatGLM2-6B

/usr/local/ChatGLM2-6B

cd /usr/local/
1.复制项目:git clone https://huggingface.co/THUDM/chatglm-6b
2.下载模块(从本地加载模型) ,需要全部下载,约20个文件
   源地址:https://huggingface.co/THUDM/chatglm-6b/tree/main (慢)
   清华地址:https://cloud.tsinghua.edu.cn/d/674208019e314311ab5c/(快)
3.在项目根目录新建一个文件夹,文件夹命名为chatglm2-6b,将下载好的放到这个目录内
(https://huggingface.co/THUDM/chatglm2-6b
https://huggingface.co/THUDM/chatglm2-6b/tree/main 这个目录下的文件全部下载,一个都不能少!!!!)



4.安装python环境 测试笔记中,最低环境需要python3.9.17
pip3.9 install -r requirements.txt

5.网页服务端依赖
pip3.9 install gradio

6.进行项目根目录(必须)运行 : 
python3.9 web_demo.py

web_demo.py文件需要调整部分内容:
web_demo.py >>>>>
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True).cuda()
------>'删除THUDM'
tokenizer = AutoTokenizer.from_pretrained("chatglm2-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("chatglm2-6b", trust_remote_code=True).cuda()

demo.queue().launch(share=False, inbrowser=True) ------>'修改端口'
demo.queue().launch(share=False, inbrowser=True,server_name="0.0.0.0",server_port=7860)
点赞

发表评论

邮箱地址不会被公开。 必填项已用*标注