赞
踩
目录
- wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
- ./Anaconda3-2021.11-Linux-x86_64.sh
- conda create -n chatglm python==3.10.4
- source activate chatglm
- conda install pip
- git clone --recursive https://github.com/THUDM/ChatGLM-6B
- cd ChatGLM-6B
- pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-
- pip install -i https://pypi.tuna.tsinghua.edu.cn/simple streamlit
- pip install -i https://pypi.tuna.tsinghua.edu.cn/simple streamlit-chat
- 修改web_demo2.py
- 修改前
- model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
- 修改后
- model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().quantize(4).cuda()
-
- 如果没有显卡
- 修改为
- model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float()
streamlit run web_demo2.py
- 下载地址 https://repo.anaconda.com/archive/Anaconda3-2021.11-Windows-x86_64.exe
- 安装 Anaconda3-2021.11-Windows-x86_64.exe
- conda create -n chatglm python==3.10.4
- activate chatglm
- conda install pip
- git clone --recursive https://github.com/THUDM/ChatGLM-6B
- cd ChatGLM-6B
- pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
-
- pip install -i https://pypi.tuna.tsinghua.edu.cn/simple streamlit
- pip install -i https://pypi.tuna.tsinghua.edu.cn/simple streamlit-chat
- 修改web_demo2.py
- 修改前
- model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
- 修改后
- model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().quantize(4).cuda()
-
- 如果没有显卡
- 修改为
- model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float()
streamlit run web_demo2.py
6. 问题报错
运行时报报一个这个错,但是icetk已经安装,许久无法解决,应该是torch相关库的版本问题,最后的解决办法,给到下面
ImportError: This modeling file requires the following packages that were not found in your environment: icetk. Run `pip install icetk`
重新安装torch库就可以了
- pip uninstall torch torchvision torchaudio
-
- pip install torch torchvision torchaudio
7 运行结果
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。