Langchain-chatchat本地部署

Langchain-chatchat本地部署

参考官网

环境配置

conda安装

minicoda下载地址

安装时注意勾选上添加环境变量。安装完成之后使用conda --version测试一下版本。

环境创建

先配置一下conda的镜像地址(使用阿里的靠谱一些),这里要修改一下用户目录下的 .condarc 文件:

scala 复制代码
channels:
  - defaults
show_channel_urls: true
default_channels:
  - http://mirrors.aliyun.com/anaconda/pkgs/main
  - http://mirrors.aliyun.com/anaconda/pkgs/r
  - http://mirrors.aliyun.com/anaconda/pkgs/msys2
custom_channels:
  conda-forge: http://mirrors.aliyun.com/anaconda/cloud
  msys2: http://mirrors.aliyun.com/anaconda/cloud
  bioconda: http://mirrors.aliyun.com/anaconda/cloud
  menpo: http://mirrors.aliyun.com/anaconda/cloud
  pytorch: http://mirrors.aliyun.com/anaconda/cloud
  simpleitk: http://mirrors.aliyun.com/anaconda/cloud

创建一个环境:

复制代码
conda create -n langchain-chatchat python=3.10

提示:其他conda命令使用看这里

激活环境

复制代码
conda activate langchain-chatchat

激活之后我们接下来各种操作基本都在这个环境中进行。

项目依赖

复制代码
# 拉取仓库。拉去不了就直接下载解压吧。
git clone https://github.com/chatchat-space/Langchain-Chatchat.git

# 进入目录
cd Langchain-Chatchat

# 安装全部依赖
pip install -r requirements.txt
# 如果有网络问题试一下这种
pip install -r requirements.txt --index-url http://mirrors.aliyun.com/pypi/simple/  --trusted-host mirrors.aliyun.com

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

模型下载

如果下载不了,梯子换一下节点哈,或者需要配置以下代理啥的,实在不行就页面上文件一个个点击下载吧。

复制代码
# 支持大文件下载
git lfs install

git clone https://huggingface.co/THUDM/chatglm2-6b

git clone https://huggingface.co/moka-ai/m3e-base

设置配置项

Langchain-Chatchat目录下配置文件:

configs/model_config.py.example复制一个为configs/model_config.py

configs/server_config.py.example复制一个为configs/server_config.py

设置llm_model_dict为LLM 模型位置;

谁知embedding_model_dict 为Embedding 模型路径;

知识库初始化与迁移

复制代码
python init_database.py --recreate-vs

一键启动

scala 复制代码
python startup.py -a

额,我的内存只有16g,达不到要求。。。看要求最少要32g内存。

相关推荐
优秘UMI29 分钟前
智能科技的附加特性:提升用户体验的多样选择
python·科技·其他·ai
哥布林学者1 小时前
吴恩达深度学习课程二: 改善深层神经网络 第一周:深度学习的实践(二)
深度学习·ai
程序员鱼皮3 小时前
1分钟对接500个大模型?这才叫 AI 开发!
计算机·ai·程序员·大模型·软件开发
Andy_shenzl7 小时前
31、LangChain开发框架(八)-- LangChain 数据分析智能体实战
数据挖掘·数据分析·langchain·agent开发
广州明周科技7 小时前
Revit 200+新功能之“房间面积图表”,房间数据可视化功能,轻松洞察项目空间信息!
ai·信息可视化·数据分析·bim·revit二次开发·revit·deepseek
ExperDot7 小时前
20 个追求极致体验的 AI 聊天软件功能
ai
王哈哈^_^18 小时前
【数据集】【YOLO】【目标检测】口罩数据集,口罩佩戴识别数据集 1971 张,YOLO佩戴口罩检测算法实战训练教程。
人工智能·算法·yolo·目标检测·计算机视觉·ai·视觉检测
CoderJia程序员甲20 小时前
GitHub 热榜项目 - 日榜(2025-10-27)
ai·开源·大模型·github·ai教程
kalvin_y_liu21 小时前
Lumi 具神智能机器人 SDK说明和ACT算法中的学习与推理
人工智能·ai·ros
liliangcsdn1 天前
如何结合langchain、neo4j实现关联检索问答
开发语言·python·langchain·neo4j