01 环境准备
1.1、升级apt
cd /home/jovyan/work/ChatGLM3/chatglm3-6b/ #进入你文件夹地址
apt-get update
1.2、安装Linux需要库
sudo apt-get update
sudo apt-get install yum
sudo apt-get install curl
1.3 、安装lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
02数据权重
2.1、下载 ChatGLM3
gitjhub:GitHub - THUDM/ChatGLM3: ChatGLM3 series: Open Bilingual Chat LLMs | 开源双语对话语言模型
git clone https://github.com/THUDM/ChatGLM3
gitee:
ChatGLM3: fork : https://github.com/THUDM/ChatGLM3 (gitee.com)
git clone https://gitee.com/aqua/ChatGLM3
2.2、下载预训练模型
用 Git LFS 从 Hugging Face Hub 将模型下载到本地,从本地加载模型响应速度更快
git lfs install
git clone https://huggingface.co/THUDM/chatglm3-6b
从 HuggingFace 下载比较慢,可以从 ModelScope 中下载
git lfs install
git clone https://www.modelscope.cn/ZhipuAI/chatglm3-6b.gi
03配置文件
3.1、ChatGLM3-6B 提供多种运行方式,包括命令行界面、Streamlit 界面和 REST API。
conda activate pytorch #进入python环境
pip install -r requirements.txt #安库
3.2修改文件路径及设置
以web_demo_streamlit.py为例:
将加载模型的路径修改为:
cd basic_demo
# 命令行界面
vim clidemo.py
python clidemo.py
#Streamlit 界面
vim web_demo_streamlit.py
streamlit run web_demo_streamlit.py --server.port 7000
得到: