利用AutoDL的远程服务器在单张3090上部署OrionStar-Yi-34B-Chat

一、注册AutoDL账号

AutoDL网址:https://www.autodl.com/

二、挑选服务器

  • 显卡型号:3090(24GB左右的显存差不多刚刚好)
  • 内存:越大越好
  • 最高支持CUDA版本:越新越好(需要记一下是否大于等于12.1,并且不要低于11.8
  • 硬盘:34B模型大概120GB,需要扩容数据盘到150GB,即扩容100GB

三、模型环境搭建及模型下载

  1. 点击JupyterLab然后等待页面加载完成后点击终端
  2. 开启自带加速
source /etc/network_turbo
  1. 跳转到数据盘AutoDL-tmp
cd AutoDL-tmp
  1. 我们使用text-generation-webui这个项目进行LLM的部署
git clone https://github.com/oobabooga/text-generation-webui.git
  1. 关闭自带加速,否则会遇到SSL安全认证的问题
unset http_proxy && unset https_proxy
  1. 跳转到text-generation-webui
cd text-generation-webui
  1. 在text-generation-webui目录下运行start_linux.sh
./start_linux.sh
  1. 稍等一下,会询问你两个问题
    第一个问题是我们的显卡品牌,由于在AutoDL上选的显卡基本都是NVIDIA的,所以选择A

    What is your GPU?
    A) NVIDIA
    B) AMD (Linux/MacOS only. Requires ROCm SDK 5.6 on Linux)
    C) Apple M Series
    D) Intel Arc (IPEX)
    N) None (I want to run models in CPU mode)
    
    Input> A
    

    第二个问题是我们想安装的CUDA版本,前面选显卡的时候如果最高支持CUDA版本大于等于12.1就选N,否则就选Y。

    Do you want to use CUDA 11.8 instead of 12.1? Only choose this option if your GPU is very old (Kepler or older).
    For RTX and GTX series GPUs, say "N". If unsure, say "N".
    
    Input (Y/N)> N
    
  2. 为了节约时间,另外开一个终端下载模型
    点击终端上方的加号,开启另一个终端

  3. 在另一个终端首先安装git-lfsnet-tools

apt update && apt install -y git-lfs net-tools
  1. 跳转到AutoDL-tmp/text-generation-webui/models文件夹中
cd AutoDL-tmp/text-generation-webui/models
  1. 下载需要部署的LLM模型,这里下载的是OrionStar-Yi-34B-Chat
git clone https://www.modelscope.cn/OrionStarAI/OrionStar-Yi-34B-Chat.git
  1. 下载过程比较漫长,可以回到终端1看看有没有完成
    如果没有完成则运行以下命令
    ./update_linux.sh
    
    直到看到Done!出现以后,再运行
    ./start_linux.sh
    
    出现
    *******************************************************************
    * WARNING: You haven't downloaded any model yet.
    * Once the web UI launches, head over to the "Model" tab and download one.
    *******************************************************************
    
    
    2023-12-12 21:49:51 INFO:Loading the extension "gallery"...
    Running on local URL:  http://127.0.0.1:7860
    
    To create a public link, set `share=True` in `launch()`.
    
    说明环境部署成功,按Ctrl+C终止进程

四、模型初始化及运行

  1. 跳转到AutoDL-tmp/text-generation-webui文件夹中
cd AutoDL-tmp/text-generation-webui
  1. 打开CMD_FLAGS.txt文件
    这部分可以自己在github的text-generation-webui项目中查找,我的参数设置选择如下:
    --multi-user
    --model OrionStar-Yi-34B-Chat
    --load-in-4bit
    --share
    --gradio-auth username:password
    --public-api
    --api-key API_KEY
    --settings SETTINGS_FILE
    --trust-remote-code
    
    替换掉API_KEY为你设置的密码,SETTINGS_FILE为修改好的配置文件,如AutoDL-tmp/text-generation-webui文件夹下的settings-template.yaml示例文件,username:password为网站的账号和密码
  2. 再运行./start_linux.sh就能运行模型,并且可以发布API了
posted @ 2023-12-12 22:59  Soapen  阅读(351)  评论(0编辑  收藏  举报