使用趋动云部署ChatGLM3-6B模型
- 1 创建项目
- 2 配置环境 + 修改代码
- 3 运行代码
 
1 创建项目
- 创建项目
  
- 进入项目 -> 运行代码 -> 选择资源(B1.large)
2 配置环境 + 修改代码
-  等待开发者工具加载完成 -> 点击 JupyterLab 进入开发环境 
  
-  打开 terminal 
  
-  在终端输入tmux,进入一个会话窗口。 
tmux
- 升级apt,安装unzip
apt-get update && apt-get install unzip
- 设置镜像源,升级pip
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple3  # 设置中科大镜像源
python3 -m pip install --upgrade pip  # 升级pip
- 克隆项目,进入项目
git config --global url."https://gitclone.com/".insteadof https://  # 将原本指向 GitHub 的远程仓库地址替换为指向 gitclone.com 的地址,以加速操作
git clone https://github.com/THUDM/ChatGLM3.git  # 克隆ChatGLM3项目
cd ChatGLM3  # 进入项目目录
- 修改 requirements.txt(删除torch>=2.0,因为我们前面已经选择了torch2.x的镜像)
  
- 安装运行环境所需的依赖
pip install -r requirements.txt
- 打开web_demo2.py,修改模型的加载路径为:../../pretrain
  
- 打开web_demo1.py,修改模型的加载路径为:../../pretrain
  
- 打开web_demo1.py,修改服务器的端口号为7000
  
- 添加端口
  
3 运行代码
1)运行 gradio 界面
python web_demo.py

-  复制外部访问链接 
  
-  打开gradio界面,测试功能 
  
2)运行 streamlit 界面
- 尝试Streamlit之前,记得CTRL+C结束gradio进程
streamlit run web_demo2.py

-  同样地,我们需要再创建一个 8501 端口 
  
-  复制外部访问链接 
  
-  浏览器打开streamlit,测试功能 
 