LangChain-Chatchat (原 Langchain-ChatGLM)(代码分享)
基于 ChatGLM 等大语言模型与 Langchain 等应用框架实现,开源、可离线部署的检索增强生成(RAG)大模型知识库项目。
部署还是比较简单的,照着文档一步一步来就行
先看下 python 版本,最好 3.10:https://www.python.org/download/releases/
python --version
然后拉取仓库,安装依赖
# 拉取仓库
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
# 进入目录
cd Langchain-Chatchat
# 安装全部依赖
pip install -r requirements.txt
我 webui 和 api 都安装,可以按需安装的
#安装API
pip install -r requirements_api.txt
#安装webui
pip install -r requirements_webui.txt
下面需要下载模型,受限需要装下 Git LFS:https://docs.github.com/zh/repositories/working-with-files/managing-large-files/installing-git-large-file-storage
git lfs install
模型一般从 HuggingFace 下载: https://huggingface.co/models
不过由于某些原因可能无法访问,我们可以从镜像站点下载:https://hf-mirror.com/models
下载模型:
git clone https://hf-mirror.com/THUDM/chatglm2-6b
git clone https://hf-mirror.com/moka-ai/m3e-base
下面复制下默认的配置文件
python copy_config_example.py
初始化知识库
python init_database.py --recreate-vs
然后启动
python startup.py -a
顺利的话可以看到当前配置: