环境镜像选择pytorch2.0.1,python3.9(cuda3.9)
资源配置:b1.large(1*24GBgpu) 1*8核24GBcpu)
1.配置环境
tmux
apt-get update && apt-get install unzip
git config --global url."https://gitclone.com/".insteadOf https://
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install --upgrade pip
git clone https://github.com/THUDM/ChatGLM3.git
cd ChatGLM3
pip install -r requirements.txt
核心代码解释
tmux
, 终端复用器,允许在一个终端窗口中同时运行多个终端会话。apt-get update && apt-get install unzip
更新包git config --global url."https://gitclone.com/".insteadOf https://
更换git代理pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
设置镜像源python3 -m pip install --upgrade pip
升级pipgit clone https://github.com/THUDM/ChatGLM3.git
克隆项目pip install -r requirements.txt
安装环境依赖
2.修改代码
- 修改
web_demo.py
、web_demo2.py
的模型路径 - 修改
web_demo2.py
的启动代码
demo.queue().launch(share=False, server_name="0.0.0.0",server_port=7000)
- 开放端口
3.试运行
1.gradio测试
python web_demo.py
注意,第一次运行时可能是需要初始化的缘故需要稍等几分钟。
2.streamlit测试
streamlit run web_demo2.py
添加相应端口测试即可。