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内存。

相关推荐
AlfredZhao10 小时前
公众号已上线 Ask AI 功能
ai·智能体·公众号·deepseek·ask ai
CodeCaster10 小时前
他来了,为大模型量身定制的响应式编程范式(1) —— 从接入 DeepSeek 开始吧
java·ai·langchain
哥不是小萝莉11 小时前
使用 DeepSeek R1 和 Ollama 开发 RAG 系统
ai·deepseek
gange57414 小时前
AI将会取代生活的方方面面吗?
人工智能·ai·ai作画·生活·ai编程·ai写作·百度云
Sator114 小时前
C#与AI的交互(以DeepSeek为例)
ai·语言模型·c#
FIT2CLOUD飞致云15 小时前
MaxKB上架至阿里云轻量应用服务器镜像市场
ai·开源·大模型·知识库·maxkb·问答
chaplinthink16 小时前
LangChain大模型框架& Dify低代码 AI 开发平台
ai·langchain·dify
做一个有理想的码农21 小时前
win11本地部署deepseek大模型(安装ollama+docker+open-webui)最终实现自己的项目可通过API调用投喂数据后的模型
docker·ai·api·ollama·deepseek
火云牌神1 天前
本地大模型编程实战(22)用langchain实现基于SQL数据构建问答系统(1)
python·sql·langchain·llama·qwen2.5
恶猫1 天前
[特殊字符]清华大学:DeepSeek从入门到精通.pdf(清华领航,驾驭DeepSeek,开启AI新境界)
ai·pdf·deepseek