美文网首页
阿里云上部署ChatGLM3-6B

阿里云上部署ChatGLM3-6B

作者: 一个人一匹马 | 来源:发表于2024-02-26 10:45 被阅读0次

1、环境说明

  • 8v-32G-V100-16G
  • linux - Centos

2、按装conda

  • 创建文件目录

    mkdir -p ~/miniconda3
    
  • 拉取镜像

    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
    
  • 启动脚本安装

    bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
    
  • 删除脚本

    rm -rf ~/miniconda3/miniconda.sh
    
  • 安装后,初始化新安装的 Miniconda。以下命令针对 bash 和 zsh shell 进行初始化:

    ~/miniconda3/bin/conda init bash
    ~/miniconda3/bin/conda init zsh
    
  • 设置conda镜像源

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
    conda config  --set show_channel_urls yes
    
  • 官网地址

    https://docs.conda.io/projects/miniconda/en/latest/
    

3、下载项目

  • 克隆项目,并进入项目目录

    git clone https://github.com/THUDM/ChatGLM3.git
    cd ChatGLM3
    

4、使用conda创建虚拟环境

  • 创建python3.10的虚拟环境

    conda create -n chatglm3 python=3.10
    
  • 激活虚拟环境

    conda activate chatglm3
    

5、下载模型

  • 安装git-lfs

    git lfs install
    
  • 下载模型

    cd ChatGLM3
    git clone https://www.modelscope.cn/ZhipuAI/chatglm3-6b.git
    

6、安装依赖

  • 激活虚拟环境,安装依赖

    cd ChatGLM3 
    pip install -r requirements.txt
    

6、模型地址修改为本地模型路径

  • MODEL_PATH都要修改

    MODEL_PATH = os.environ.get('MODEL_PATH', '/data/ChatGLM3/chatglm3-6b')
    

7、启动

  • 使用本地模型加载并使用命令行来问答

    python cli_demo.py
    
  • 使用本地模型加载并使用web_demo来问答

    python web_demo.py
    
  • 通过以下命令启动基于 Gradio 的网页版 demo

    python web_demo.py
    
  • 通过以下命令启动基于 Streamlit 的网页版 demo,与Gradio相同,但是更加流畅

    streamlit run web_demo2.py
    
  • OpenAI 格式的流式 API 部署

    cd openai_api_demo
    python openai_api.py
    

8、接入 One API

  • 为 chatglm2 添加一个渠道,参数如下


    image.png

9、接入 FastGPT

  • 修改 config.json 配置文件,在 ChatModels 中加入 chatglm2 模型
image.png

10、测试使用

  • chatglm3 模型的使用方法如下:

  • 模型选择 chatglm3 即可

相关文章

  • flask 部署阿里云

    1.上周入手了阿里云,所以把前段时间写的flask程序部署到阿里云上,之前是部署到heroku上的,下面介绍下如何...

  • swift web框架 Vapor 使用记录(三)

    阿里云vapor部署走起 上次双12,用新账户撸了个3年的阿里云服务器,决定就把服务器端部署在阿里云上。 1.安装...

  • 阿里云+Centos+Django +Apache+mod_ws

    阿里云上部署Django项目 1、首先阿里云上安装Centos7系统 此处省略安装流程 安装好以后设置阿里云上面实...

  • Python-django项目部署教程

    项目开发完成后可以部署到阿里云,华为云,腾讯云等服务器,以腾讯云为例 本地部署 以下是ubuntu上的部署详细步骤...

  • Temporary failure in name resolu

    问题描述 由于公司业务需要,将之前部署在阿里云上的Spring Boot应用迁移到了华为云的VPC上,之前在阿里云...

  • 课程设计问题总结

    一些部署到阿里云的问题 一直在阿里云上部署项目,但是只是以ip:端口的形式去进行访问部署到阿里云的项目,个人觉得很...

  • 在阿里云部署 Flask 应用

    原文首发于CSDN,略有增删 在阿里云部署 Flask 应用 本文简单记录在阿里云部署 Flask 应用的过程。由...

  • nuxt 踩坑

    1. 部署到阿里云 无法通过 ip:端口 访问 npm build 好后部署到阿里云 centos服务器 curl...

  • 在Ubuntu 14中安装python3.5

    最近搞了一个阿里云,准备部署下python2+python3的双环境。其实,阿里云上的ubuntu已经自带了pyt...

  • nodejs: mac上阿里云部署

    ??? 今天是双11,你剁手了吗!反正我没手剁了!感觉双11不买点什么东西感觉不合众,索性在索尼官网店买了耳机,...

网友评论

      本文标题:阿里云上部署ChatGLM3-6B

      本文链接:https://www.haomeiwen.com/subject/dfnrndtx.html