芜湖公司网站建设,国内新闻最新消息2022,自助建站系统免授权版,wordpress搭建官网步骤在发布了《 Langchain-Chatchat-win10本地安装部署成功笔记#xff08;CPU#xff09;》后#xff0c;有不少同学给我私信#xff0c;说根据我的文档安装成功#xff0c;也有不少人在安装过程报错了#xff0c;我的文章是基于V0.2.6版本写的#xff0c;大部分都是因为升… 在发布了《 Langchain-Chatchat-win10本地安装部署成功笔记CPU》后有不少同学给我私信说根据我的文档安装成功也有不少人在安装过程报错了我的文章是基于V0.2.6版本写的大部分都是因为升级版本引起的。当前最新版本是V0.2.10经过验证V0.2.9按照原来的文章或官网的安装部署文档说明进行私有化安装部署都会出现一些问题,建议用V0.2.10版本。
本文专注记录安装部署新版本出现的问题和解决方法。
版本更新记录
V0.2.10
重要提示
Langchain-Chatchat v0.2.10 版本中修改了configs中配置项建议所有用户按照 Wiki 的开发部署中的相关描述重新完成项目中的配置文件生成。开发部署过程遇到问题请先到 Github Wiki / issues 中搜索。
本次更新中依赖 Python 包与其版本发生了大量更新请使用pip install -r requirements.txt进行更新。
此版本为 v0.2.x系列最后一个版本具备全新 Agent 功能的 v0.3.0即将上线敬请期待。
新增功能
优化 PDF 文件的 OCR过滤无意义的小图片 by liunux4odoo #2525支持 Gemini 在线模型 by yhfgyyf #2630支持 GLM4 在线模型 by zRzRzRzRzRzRzRelasticsearch更新https连接 by xldistance #2390增强对PPT、DOC知识库文件的OCR识别 by 596192804 #2013更新 Agent 对话功能 by zRzRzRzRzRzRzR每次创建对象时从连接池获取连接避免每次执行方法时都新建连接 by Lijia0 #2480实现 ChatOpenAI 判断token有没有超过模型的context上下文长度 by glide-the更新运行数据库报错和项目里程碑 by zRzRzRzRzRzRzR #2659更新配置文件/文档/依赖 by imClumsyPanda zRzRzRzRzRzRzR添加日文版 readme by eltociear #2787
问题修复
ApiRequest.agent_chat 返回 dict 而非 str by liunux4odoo #2520修复milvus_kwargs问题 by hzg0601 #2540纠正 make_text_splitter 中 chunk_* parameters 参数的使用 by liunux4odoo #2564过滤 sse_starlette 返回的 ping 包避免 JSON Decoder error : ping -... by liunux4odoo #2585langchain 更新后PGVector 向量库连接错误 by HALIndex #2591删除重复的引入和纠正拼写错误 by tiandiweizun #2599Minimaxs model worker 错误 by xyhshenES库无法向量检索.添加mappings创建向量索引 by MSZheng20 #2688KBService 中几处拼写错误 by hzg0601 #2640pytorch 自动检测设备 by chatgpt-1, Drincann, zRzRzRzRzRzRzR #2514 #2570
V0.2.9
重要提示
Langchain-Chatchat v0.2.9 版本中修改了configs中配置项建议所有用户按照 Wiki 的开发部署中的相关描述重新完成项目中的配置文件生成。开发部署过程遇到问题请先到 Github Wiki / issues 中搜索。
此外v0.2.9 版本中知识库相关信息的数据库表发生了变化如果继续使用之前版本的配置可使用 python init_database.py --create-tables 仅更新数据库表不重建知识库。
本次更新中依赖 Python 包与其版本发生了大量更新请使用pip install -r requirements.txt进行更新。
新增功能
文件对话和知识库对话 API 接口实现全异步操作防止阻塞 by liunux4odoo in #2256更新默认模型下载链接 by YQisme in #2259OCR 支持 GPU 加速需要手动安装 rapidocr_paddle[gpu])知识库支持 MHTML 和 Evernote 文件。 by liunux4odoo in #2265使用Reranker模型对召回语句进行重排 by hzg0601 in #2435知识库管理界面支持查看、编辑、删除向量库文档 by liunux4odoo in #2471
问题修复
修改 duckduckgo 依赖错误 by zRzRzRzRzRzRzR hzg0601 in #2251 and #2252修复Azure 不设置Max token的bug by zRzRzRzRzRzRzR in #2254fix: prompt template name error in file_chat by liunux4odoo in #2366优化EventSource回包 by lookou in #1200fix: 文档错误 by jaluik in #2384更新 self.dims_length 赋值错误 by xldistance in #2380修复knowledge_base_chat_iterator 传参错误 by xldistance in #2386fixed 迭代器参数传递错误知识库问答报错TypeError: unhashable type: list by Astlvk in #2383fix:使用在线embedding模型时 报错 There is no current event loop in thread Any… by Funkeke in #2393fix Yi-34b model config error(close #2491) by liunux4odoo in #2492remove /chat/fastchat API endpoint by liunux4odoo in #2506
V0.2.8
重要提示
Langchain-Chatchat v0.2.8 版本中修改了configs中配置项建议所有用户按照 Wiki 的开发部署中的相关描述重新完成项目中的配置文件生成。开发部署过程遇到问题请先到 Github Wiki / issues 中搜索。
此外v0.2.8 版本中知识库相关信息的数据库表发生了变化且默认 embedding 模型修改为bge-large-zh如保持默认设置请按需重建知识库。如果继续使用之前版本的配置可使用 python init_database.py --create-tables 仅更新数据库表不重建知识库。
本次更新中依赖 Python 包与其版本发生了大量更新请使用pip install -r requirements.txt进行更新。
新增功能
添加文件对话模式 by liunux4odoo in #2071知识库支持 .jsonl, .epub, .xlsx, .xlsd, .ipynb, .odt, .py, .srt, .toml, .doc, .ppt 文件 by liunux4odoo in #2079支持昆仑万维天工大模型 by nathubs in #2166完善对 ChatGLM3-6B 的支持 by zRzRzRzRzRzRzR in #2021 and #2058增加聊天记录在数据库中的存储 by qiankunli in #2046完善 WebUI 模型列表中对在线模型和本地模型的支持 by liunux4odoo in #2060支持软连接的知识库 by zRzRzRzRzRzRzR in #2167给 ApiModelWorker 添加 logger 成员变量API请求出错时输出有意义的错误信息。 by liunux4odoo in #2169提供文档 summary_chunk 支持单文件总结业务实现使用 MapReduceDocumentsChain 生成摘要 by glide-the in #2175单个知识库根据 doc_ids 摘要 by glide-the in #2176添加自定义命令用于管理多会话 by liunux4odoo in #2229优化知识库文档加载 by liunux4odoo in #2091统一在线模型异常报文、增加详细日志 by glide-the in #2130更新 ChatGLM3-6B agent的文档提示词 by zRzRzRzRzRzRzR in #2041更新 requirements by liunux4odoo hzg0601 zRzRzRzRzRzRzR imClumsyPanda in #2033 , #2170 , #2213 and #2246更新 README.md by VignetteApril weartist in #2034 and #2049更新 config 模版 by hzg0601 zRzRzRzRzRzRzR imClumsyPanda in #2110 and #2171数据库和向量库中文档 metadata[source] 改为相对路径便于向量库迁移 by liunux4odoo in #2153
问题修复
修复知识库json文件的中文被转为 unicode 码导致无法匹配 by liunux4odoo in #2128将 MiniMax 和 千帆 在线 Embedding 改为 10 个文本一批防止接口数量限制 by liunux4odoo in #2161修复 startup.py by hzg0601 in #2162 and #2173bug 修复和提示词修改 by zRzRzRzRzRzRzR in #2230一些细节更新 by zRzRzRzRzRzRzR in #2235修复: MiniMax 和千帆在线 embedding 模型分批请求的 bug by alanlaye617 in #2208修复: chat 接口默认使用 memory 获取 10 条历史消息导致最终拼接的 prompt 出错 by liunux4odoo in #2247
模型文件共享
可能有些同学没有对应的模型文件共享一下我用到的几个模型可持续更新要是访问不了可私信。
链接https://pan.baidu.com/s/1phG6lDVoOzhyuROqyZInBA?pwddyqv
提取码dyqv
快速安装命令
假设已安装torch以下命令是基于V0.2.10版本进行安装部署的。
#1、拉取代码
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
#2、到langchain源码根目录
cd Langchain-Chatchat
#3、安装依赖
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/#4、自动生产配置文件configs目录下复制所有example配置文件去掉example
python copy_config_example.py#5、修改model_config.py文件
# 选用的 Embedding 名称内置模型
#EMBEDDING_MODEL bge-large-zh-v1.5
EMBEDDING_MODEL bge-large-zh
# Embedding 模型运行设备。设为 auto 会自动检测(会有警告)也可手动设定为 cuda,mps,cpu,xpu 其中之一。
EMBEDDING_DEVICE cpu#内置模型地址
#bge-large-zh: BAAI/bge-large-zh,
bge-large-zh: E:\\llm_models\\bge-large-zh,#LLM_MODELS [chatglm3-6b, zhipu-api, openai-api]
#默认启动模型根据实际情况修改
LLM_MODELS [chatglm2-6b-int4, openai-api]
LLM_DEVICE cpuopenai-api: {model_name: gpt-4,api_base_url: https://api.openai.com/v1,#修改open -api key如果不启动open api就不用修改添加api_keyapi_key: sk-xxxxxxxxxx,openai_proxy: ,},llm_model: {chatglm2-6b: THUDM/chatglm2-6b,chatglm2-6b-32k: THUDM/chatglm2-6b-32k,chatglm3-6b: THUDM/chatglm3-6b,chatglm3-6b-32k: THUDM/chatglm3-6b-32k,#添加一条chatglm2-6b-int4如果用其他版本的对应修改chatglm2-6b-int4: E:\\llm_models\\chatglm2-6b-int4,#6、重新初始化数据库
python init_database.py --recreate-vs
#注意不要用python3 init_database.py --recreate-vs#7、启动
python startup.py -a
FAQ集
问题1 No moule named langchain
\L029\Langchain-Chatchatpython startup.py -a
Traceback (most recent call last):File D:\opt\L029\Langchain-Chatchat\startup.py, line 21, in modulefrom configs import (File D:\opt\L029\Langchain-Chatchat\configs\__init__.py, line 1, in modulefrom .basic_config import *File D:\opt\L029\Langchain-Chatchat\configs\basic_config.py, line 3, in moduleimport langchain
ModuleNotFoundError: No module named langchain
Q1
pip3 install langchain
问题2 No module named fastapi/ fastapi/httpx等
python startup.py -a
C:\Users\xxxxx\.conda\envs\l3\lib\site-packages\langchain\chat_models\__init__.py:31: LangChainDeprecationWarning: Importing chat models from langchain is deprecated. Importing from langchain will no longer be supported as of langchain0.2.0. Please import from langchain-community instead:from langchain_community.chat_models import ChatOpenAI.To install langchain-community run pip install -U langchain-community.warnings.warn(
C:\Users\xxxxx\.conda\envs\l3\lib\site-packages\langchain\llms\__init__.py:548: LangChainDeprecationWarning: Importing LLMs from langchain is deprecated. Importing from langchain will no longer be supported as of langchain0.2.0. Please import from langchain-community instead:from langchain_community.llms import OpenAI.To install langchain-community run pip install -U langchain-community.warnings.warn(
C:\Users\xxxxx\.conda\envs\l3\lib\site-packages\langchain\llms\__init__.py:548: LangChainDeprecationWarning: Importing LLMs from langchain is deprecated. Importing from langchain will no longer be supported as of langchain0.2.0. Please import from langchain-community instead:from langchain_community.llms import AzureOpenAI.To install langchain-community run pip install -U langchain-community.warnings.warn(
C:\Users\xxxxx\.conda\envs\l3\lib\site-packages\langchain\llms\__init__.py:548: LangChainDeprecationWarning: Importing LLMs from langchain is deprecated. Importing from langchain will no longer be supported as of langchain0.2.0. Please import from langchain-community instead:from langchain_community.llms import Anthropic.To install langchain-community run pip install -U langchain-community.warnings.warn(
Traceback (most recent call last):File D:\opt\L029\Langchain-Chatchat\startup.py, line 35, in modulefrom server.utils import (fschat_controller_address, fschat_model_worker_address,File D:\opt\L029\Langchain-Chatchat\server\utils.py, line 14, in moduleimport httpx
ModuleNotFoundError: No module named httpx Q2
这种情况下很可能安装了其他东西重装一下requirments.txt的依赖
我的环境问题主要是重新安装了一下torch的GPU版本然后就启动不了了重新安装依赖后就正常
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
待解决问题
待解决问题1
2024-01-26 14:14:43,285 - utils.py[line:295] - INFO: RapidOCRLoader used for D:\opt\L029\Langchain-Chatchat\knowledge_base\samples\content\llm/img/大模型应用技术原理-幕布图片-580318-260070.jpg
None is not a local folder and is not a valid model identifier listed on https://huggingface.co/models
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with huggingface-cli login or by passing tokenyour_tokenNone is not a local folder and is not a valid model identifier listed on https://huggingface.co/models
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with huggingface-cli login or by passing tokenyour_tokenNone is not a local folder and is not a valid model identifier listed on https://huggingface.co/models
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with huggingface-cli login or by passing tokenyour_token
这个问题在初始化数据库发生的待研究。
待解决问题2
Batches: 100%|████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:3400:00, 34.01s/it]
(samples, test_files/langchain-ChatGLM_closed.jsonl, 从文件 samples/test_files/langchain-ChatGLM_closed.jsonl 加载文档时出错jq package not found, please install it with pip install jq)
虽然有方案说用conda install jq事实上没有作用从issue里看需要修改源码。