当前位置:   article > 正文

LangChain+ChatGLM2阿里云部署_langchain + chatglm2

langchain + chatglm2

1. 阿里云环境创建

阿里云PAI平台为算法开发者打造了云端深度学习开发环境,提供了免费试用,可在上面部署LLM。

  • Cuda版本查看:
ls -l /usr/local | grep cuda
  • 1
  • pytorch版本查看:
python
import torch
print(torch.__version__)
  • 1
  • 2
  • 3
  • 领取免费试用
    在这里插入图片描述
  • 创建实例
    在这里插入图片描述
    在这里插入图片描述
  • 进入terminal,更新环境
    在这里插入图片描述
apt-get update
apt-get install git-lfs 
git init
git lfs install 
  • 1
  • 2
  • 3
  • 4

2. LangChain+ChatGLM2部署过程

  • 下载ChatGLM2-6B源码
git clone https://github.com/THUDM/ChatGLM2-6B.git
  • 1
  • 下载ChatGLM2-6B模型:
git clone https://www.modelscope.cn/ZhipuAI/ChatGLM2-6B.git
  • 1
  • 下载langchain-ChatGLM源码:
git clone https://github.com/imClumsyPanda/langchain-ChatGLM.git
  • 1
  • 下载嵌入式模型:
cd langchain-ChatGLM
git clone https://www.modelscope.cn/thomas/text2vec-base-chinese.git
  • 1
  • 2
  • 安装依赖
cd ChatGLM2-6B 
pip install –r requirements.txt
cd langchain-ChatGLM
pip install –r requirements.txt
  • 1
  • 2
  • 3
  • 4
  • 创建知识库
python init_database.py --recreate-vs
  • 1

在这里插入图片描述

  • 执行私有库模型
  1. 执行python startup.py -a
    在这里插入图片描述
  2. 采用模型对话
    在这里插入图片描述
  3. 添加私有库
    在这里插入图片描述
  4. 私有库对话
    添加图片注释,不超过 140 字(可选)
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/357408
推荐阅读
相关标签
  

闽ICP备14008679号