在往后得部署手册中,即会讲到如何部署,也会讲到如何跑通,用370的可以跟着搞,不用370的也可以看下如何部署,在GPU也是通用的
MLU370-M8部署langchain-chatchat大模型+RAG
一、南京智算平台环境选择
显卡选择: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