赞
踩
在发布了《 Langchain-Chatchat-win10本地安装部署成功笔记(CPU)》后,有不少同学给我私信,说根据我的文档安装成功,也有不少人在安装过程报错了,我的文章是基于V0.2.6版本写的,大部分都是因为升级版本引起的。当前最新版本是V0.2.10,经过验证V0.2.9按照原来的文章或官网的安装部署文档说明进行私有化安装部署都会出现一些问题,建议用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即将上线,敬请期待。
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
进行更新。
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
进行更新。
可能有些同学没有对应的模型文件,共享一下我用到的几个模型,可持续更新,要是访问不了,可私信。
- 链接:https://pan.baidu.com/s/1phG6lDVoOzhyuROqyZInBA?pwd=dyqv
- 提取码: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 = "cpu"
-
-
- "openai-api": {
- "model_name": "gpt-4",
- "api_base_url": "https://api.openai.com/v1",
- #修改open -api key,如果不启动open api就不用修改添加api_key
- "api_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
- \L029\Langchain-Chatchat>python startup.py -a
- Traceback (most recent call last):
- File "D:\opt\L029\Langchain-Chatchat\startup.py", line 21, in <module>
- from configs import (
- File "D:\opt\L029\Langchain-Chatchat\configs\__init__.py", line 1, in <module>
- from .basic_config import *
- File "D:\opt\L029\Langchain-Chatchat\configs\basic_config.py", line 3, in <module>
- import langchain
- ModuleNotFoundError: No module named 'langchain'
pip3 install langchain
- >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 langchain==0.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 langchain==0.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 langchain==0.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 langchain==0.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 <module>
- from server.utils import (fschat_controller_address, fschat_model_worker_address,
- File "D:\opt\L029\Langchain-Chatchat\server\utils.py", line 14, in <module>
- import httpx
- ModuleNotFoundError: No module named 'httpx'
这种情况下,很可能安装了其他东西,重装一下requirments.txt的依赖
我的环境问题主要是重新安装了一下torch的GPU版本,然后就启动不了了,重新安装依赖后就正常
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
- Building wheels for collected packages: jq, pysrt, streamlit-modal, sgmllib3k
- Building wheel for jq (pyproject.toml) ... error
- error: subprocess-exited-with-error
-
- × Building wheel for jq (pyproject.toml) did not run successfully.
- │ exit code: 1
- ╰─> [5 lines of output]
- running bdist_wheel
- running build
- running build_ext
- Executing: ./configure CFLAGS=-fPIC --prefix=C:\Users\xxx\AppData\Local\Temp\pip-install-j7c7k4bx\jq_9d733042867f41deaf65d6ad1794be6c\_deps\build\onig-install-6.9.8
- error: [WinError 2] 系统找不到指定的文件。
- [end of output]
-
- note: This error originates from a subprocess, and is likely not a problem with pip.
- ERROR: Failed building wheel for jq
- Building wheel for pysrt (setup.py) ... done
- Created wheel for pysrt: filename=pysrt-1.1.2-py3-none-any.whl size=13464 sha256=fbff3ed0c568e650bfd383891cbf637cc8539440f77b7cae1dfc2d60213bdb72
- Stored in directory: c:\users\xxx\appdata\local\pip\cache\wheels\8c\b7\58\74aa4c25086b8543b17de4454dcac97a641f7750e8e654b2c9
- Building wheel for streamlit-modal (setup.py) ... done
- Created wheel for streamlit-modal: filename=streamlit_modal-0.1.0-py3-none-any.whl size=4220 sha256=21e9cf2461d531b5836abebd3de05a7794089b31631172c3df82b263c635a2e4
- Stored in directory: c:\users\xxx\appdata\local\pip\cache\wheels\2e\0c\e0\0654ef5121fbcf01422a557ef2ac4cd8aff9b94b24b93c4363
- Building wheel for sgmllib3k (setup.py) ... done
- Created wheel for sgmllib3k: filename=sgmllib3k-1.0.0-py3-none-any.whl size=6061 sha256=6d9c52f7965461b9271561e621e92e6154a0d617780a976b5f07bfc794085458
- Stored in directory: c:\users\xxx\appdata\local\pip\cache\wheels\50\20\4b\e95fc891917d652cb6ecbfea035cf3ce640259cf857aaa21a7
- Successfully built pysrt streamlit-modal sgmllib3k
- Failed to build jq
- ERROR: Could not build wheels for jq, which is required to install pyproject.toml-based projects
conda install jq
需要修改处理json的代码
- 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 `token=<your_token>`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 `token=<your_token>`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 `token=<your_token>`
这个问题在初始化数据库发生的,待研究。
- Batches: 100%|████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:34<00: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里看,需要修改源码。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。