Langchain-Chatchat

Langchain-Chatchat

简介

Langchain-Chatchat 是一个可以实现:完全本地化推理的知识库增强方案, 重点解决数据安全保护,私域化部署的企业痛点。 开源方案采用Apache License,可以免费商用,无需付费。

支持市面上主流的本地大语言模型和Embedding嵌入式模型,支持开源的本地向量数据库。

Github:https://github.com/chatchat-space/Langchain-Chatchat

安装部署

# 拉取仓库
 git clone https://github.com/chatchat-space/Langchain-Chatchat.git

# 进入目录
 cd Langchain-Chatchat

# 安装全部依赖
 pip install -r requirements.txt
 pip install -r requirements_api.txt
 pip install -r requirements_webui.txt

# 默认依赖包括基本运行环境(FAISS向量库)。如果要使用 milvus/pg_vector 等向量库,请将 requirements.txt 中相应依赖取消注释再安装。

# https://huggingface.co/ 下载不了,可以用[https://hf-mirror.com) 下载大模型文件

git lfs install

git clone https://hf-mirror.com/THUDM/chatglm3-6b

git clone https://hf-mirror.com/BAAI/bge-large-zh-v1.5

初始化知识库和配置文件

py copy_config_example.py
py init_database.py --recreate-vs

启动

py startup.py -a

webui地址:http://127.0.0.1:8501/

swagger接口地址:http://127.0.0.1:7861/docs

配置文件

model_config.py

修改LLM模型和Embedding模型配置

server_config.py

服务端口设置等

安装过程中常见错误

1.提示 ModuleNotFoundError: No module named ‘pwd’,这个模块是Unix系统上的,Windows 上并没有,所以我们需要进行降级:

pip install langchain-community==0.0.19

2.提示错误信息 | ERROR | stderr | AssertionError: Torch not compiled with CUDA enabled

说明你没有安装CUDA环境或者你安装的PyTorch版本不支持CUDA,解决方法:

pip uninstall torch torchvision torchaudio

通过上面的命令进行卸载后重新安装官方给出的正确版本,安装命令如下:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

posted @ 2024-04-15 09:31  曹化金  阅读(283)  评论(0编辑  收藏  举报