【工具篇】MLU370-M8部署langchain-chatchat大模型+RAG!

在往后得部署手册中,即会讲到如何部署,也会讲到如何跑通,用370的可以跟着搞,不用370的也可以看下如何部署,在GPU也是通用的


一、南京智算平台环境选择

显卡选择:MLU370-M8 V5.10.22
环境选择:pytorch v1.17_torch1.13.1_ubnutu20.04_py310
在这里插入图片描述

二、环境准备

里面所有用到的模型,都是已经改过的,至于怎么改请看我之前的博客,本手册主要讲解langchain-chatchat部署

1.代码准备

#拉取社区代码
git clone https://githubfast.com/chatchat-space/Langchain-Chatchat.git
#转换社区代码,此转换会把社区代码cuda引擎转换成mlu引擎
python /torch/src/catch/tools/torch_gpu2mlu/torch_gpu2mlu.py -i Langchain-Chatchat/

transformers

git clone -b v4.37.2 https://githubfast.com/huggingface/transformers.git
#转换社区代码,此转换会把社区代码cuda引擎转换成mlu引擎
python /torch/src/catch/tools/torch_gpu2mlu/torch_gpu2mlu.py -i transformers/
pip install -e ./transformers_mlu

accelerate

git clone -b v0.24.1 https://githubfast.com/huggingface/accelerate.git
python /torch/src/catch/tools/torch_gpu2mlu/torch_gpu2mlu.py -i accelerate/
pip install -e ./accelerate_mlu

fschat

git clone -b v0.2.35 https://github.com/lm-sys/FastChat.git
python /torch/src/catch/tools/torch_gpu2mlu/torch_gpu2mlu.py -i FastChat/
cd FastChat_mlu/ && pip3 install -e ".[model_worker,webui]"

2.环境安装

#安装webui相关环境 
cd Langchain-Chatchat_mlu/ && pip install -r requirements_webui.txt

以下是更改后的requiments.txt直接复制安装

sentence_transformers==2.2.2
langchain==0.0.354
langchain-experimental==0.0.47
pydantic==1.10.13
openai==1.9.0
fastapi==0.109.0
sse_starlette==1.8.2
nltk==3.8.1
uvicorn>=0.27.0.post1
starlette==0.35.0
unstructured[all-docs] # ==0.11.8
python-magic-bin; sys_platform == 'win32'
SQLAlchemy==2.0.25
faiss-cpu==1.7.4
spacy==3.7.2
PyMuPDF==1.23.16
rapidocr_onnxruntime==1.3.8
requests==2.31.0
pathlib==1.0.1
pytest==7.4.3
numexpr==2.8.6
strsimpy==0.2.1
markdownify==0.11.6
tiktoken==0.5.2
tqdm==4.66.1
jwt
websockets==12.0
numpy==1.24.4
pandas==2.0.3
einops==0.7.0
transformers_stream_generator==0.0.4
llama-index==0.9.35

3.运行指南

cd  Langchain-Chatchat_mlu
#1.复制配置文件
python copy_config_example.py
#2.修改配置文件configs/model_config.py
将MODEL_PATH路径修改成自己的模型路径
#知识库简单配置
python init_database.py --recreate-vs
#运行
python startup.py -a

4.运行效果

LLM能力OK
在这里插入图片描述
RAG能力OK
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值