侧边栏壁纸
  • 累计撰写 88 篇文章
  • 累计创建 41 个标签
  • 累计收到 4 条评论

目 录CONTENT

文章目录

Langchain-Chatchat 安装记录

勤为径苦作舟
2023-10-13 / 0 评论 / 0 点赞 / 503 阅读 / 0 字

简介

本文使用 Windows 11 + Python 3.10.3 + CUDA 11.8 + Langchain-Chatchat + THUDM/chatglm2-6b-32k-int4 + sensenova/piccolo-large-zh 构建知识库。

使用其他分词和数据库待完善……

环境准备

部署 Langchain-Chatchat

按照 Langchain-Chatchat 开发部署文档部署。

报错解决

  • git lsf 报错:
    Use `git lfs logs last` to view the log.
    error: external filter 'git-lfs filter-process' failed
    fatal: pytorch_model.bin: smudge filter lfs failed
    warning: Clone succeeded, but checkout failed.
    You can inspect what was checked out with 'git status'
    and retry with 'git restore --source=HEAD :/'
    
    git lfs install --skip-smudge
    git clone git@hf.co:THUDM/chatglm2-6b-32k-int4
    cd chatglm2-6b-32k-int4
    git lfs pull
    
  • python init_database.py --recreate-vs时报错,删除knowledgebase目录下的vector_store
    Traceback (most recent call last):  
    File "/home/tskj/Langchain-Chatchat-0.2.5/Langchain-Chatchat-master/init_database.py", line 81, in  
    folder2db(kb_names=args.kb_name, mode="recreate_vs")  
    File "/home/tskj/Langchain-Chatchat-0.2.5/Langchain-Chatchat-master/server/knowledge_base/migrate.py", line 76, in folder2db  
    files2vs(kb_name, kb_files)  
    File "/home/tskj/Langchain-Chatchat-0.2.5/Langchain-Chatchat-master/server/knowledge_base/migrate.py", line 63, in files2vs  
    kb.add_doc(kb_file=kb_file, not_refresh_vs_cache=True)  
    File "/home/tskj/Langchain-Chatchat-0.2.5/Langchain-Chatchat-master/server/knowledge_base/kb_service/base.py", line 100, in add_doc  
    doc_infos = self.do_add_doc(docs, **kwargs)  
    File "/home/tskj/Langchain-Chatchat-0.2.5/Langchain-Chatchat-master/server/knowledge_base/kb_service/faiss_kb_service.py", line 72, in do_add_doc  
    ids = vs.add_documents(docs)  
    File "/home/tskj/miniconda3/envs/chatchat/lib/python3.10/site-packages/langchain/schema/vectorstore.py", line 104, in add_documents  
    return self.add_texts(texts, metadatas, **kwargs)  
    File "/home/tskj/miniconda3/envs/chatchat/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 167, in add_texts  
    return self.__add(texts, embeddings, metadatas=metadatas, ids=ids)  
    File "/home/tskj/miniconda3/envs/chatchat/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 139, in __add  
    self.index.add(vector)  
    File "/home/tskj/miniconda3/envs/chatchat/lib/python3.10/site-packages/faiss/class_wrappers.py", line 228, in replacement_add  
    assert d == self.d  
    AssertionError
    
  • python startup.py --all-webui时报错Max retries exceeded with url: /register_worker……,修改server_config.pyDEFAULT_BIND_HOST的值为127.0.0.1

  • 修改model_config.pyEMBEDDING_DEVICE的值为cuda后启动报错raise AssertionError("Torch not compiled with CUDA enabled"),安装 torch cuda 指定版本:

    pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html --trusted-host pypi.org --trusted-host download.pytorch.org --trusted-host files.pythonhosted.org
    

    找对应版本的话就在 https://download.pytorch.org/whl/torch_stable.html 看。

  • 启动报错:

    transformers_modules.chatglm2-6b-32k-int4.quantization | Failed to load cpm_kernels:No module named 'cpm_kernels'
    ……
    AttributeError: 'NoneType' object has no attribute 'int4WeightExtractionHalf'
    

    安装 cpm_kernels 即可。

    pip install cpm_kernels
    
  • 搜索引擎问答时报错API 通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)

    ImportError: Could not import duckduckgo-search python package. Please install it with `pip install duckduckgo-search`.
    2023-10-12 19:04:59 | ERROR | root | RemoteProtocolError: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
    

    安装 duckduckgo-search 即可。

    pip install duckduckgo-search
    

效果

参考

0

评论区