chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
32.07k stars 5.58k forks source link

加载md文件出错 #98

Closed cocomany closed 1 year ago

cocomany commented 1 year ago

运行 webui.py后能访问页面,上传一个md文件后,日志中有错误。等待后能加载完成,提示可以提问了,但提问没反应,日志中有错误。 具体日志如下。

$ python webui.py
/data/py310/lib/python3.10/site-packages/gradio/components.py:167: UserWarning: Unknown style parameter: height
  warnings.warn(f"Unknown style parameter: {key}")
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Loading checkpoint shards:  12%|█████████████▉                                                                                                 | 1/8 [00:09<01:04,  9.22s/it][nltk_data] Downloading package punkt to /home/ubuntu/nltk_data...
[nltk_data]   Unzipping tokenizers/punkt.zip.
[nltk_data] Downloading package averaged_perceptron_tagger to
[nltk_data]     /home/ubuntu/nltk_data...
[nltk_data]   Unzipping taggers/averaged_perceptron_tagger.zip.
langchain-ChatGLM README.md 已成功加载
Traceback (most recent call last):
  File "/data/py310/lib/python3.10/site-packages/gradio/routes.py", line 401, in run_predict
    output = await app.get_blocks().process_api(
  File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1302, in process_api
    result = await self.call_function(
  File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1025, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/data/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/data/github/langchain-ChatGLM/webui.py", line 121, in <lambda>
    kb.init_knowledge_vector_store(
  File "/data/github/langchain-ChatGLM/knowledge_based_chatglm.py", line 73, in init_knowledge_vector_store
    vector_store = FAISS.from_documents(docs, embeddings)
NameError: name 'embeddings' is not defined
Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [01:37<00:00, 12.16s/it]Downloading (…)58aa3/.gitattributes: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 1.48k/1.48k [00:00<00:00, 1.50MB/s]Downloading (…)026ff58aa3/README.md: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 317/317 [00:00<00:00, 295kB/s]Downloading (…)6ff58aa3/config.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 821/821 [00:00<00:00, 871kB/s]Downloading (…)aa3/eval_results.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 69.0/69.0 [00:00<00:00, 72.1kB/s]Downloading pytorch_model.bin: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 1.30G/1.30G [00:03<00:00, 421MB/s]Downloading (…)cial_tokens_map.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 125/125 [00:00<00:00, 114kB/s]Downloading (…)58aa3/tokenizer.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 439k/439k [00:00<00:00, 78.6MB/s]Downloading (…)okenizer_config.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 514/514 [00:00<00:00, 529kB/s]Downloading (…)026ff58aa3/vocab.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 110k/110k [00:00<00:00, 61.1MB/s]No sentence-transformers model found with name /home/ubuntu/.cache/torch/sentence_transformers/GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling.     
No sentence-transformers model found with name /home/ubuntu/.cache/torch/sentence_transformers/GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling.
Traceback (most recent call last):
  File "/data/py310/lib/python3.10/site-packages/gradio/routes.py", line 401, in run_predict
    output = await app.get_blocks().process_api(
  File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1302, in process_api
    result = await self.call_function(
  File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1025, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/data/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/data/github/langchain-ChatGLM/webui.py", line 31, in get_answer
    resp, history = kb.get_knowledge_based_answer(
  File "/data/github/langchain-ChatGLM/knowledge_based_chatglm.py", line 95, in get_knowledge_based_answer
    retriever=vector_store.as_retriever(search_kwargs={"k": VECTOR_SEARCH_TOP_K}),
AttributeError: 'NoneType' object has no attribute 'as_retriever'
Traceback (most recent call last):
  File "/data/py310/lib/python3.10/site-packages/gradio/routes.py", line 401, in run_predict
    output = await app.get_blocks().process_api(
  File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1302, in process_api
    result = await self.call_function(
  File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1025, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/data/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/data/github/langchain-ChatGLM/webui.py", line 31, in get_answer
    resp, history = kb.get_knowledge_based_answer(
  File "/data/github/langchain-ChatGLM/knowledge_based_chatglm.py", line 95, in get_knowledge_based_answer
    retriever=vector_store.as_retriever(search_kwargs={"k": VECTOR_SEARCH_TOP_K}),
AttributeError: 'NoneType' object has no attribute 'as_retriever'
imClumsyPanda commented 1 year ago

请按照对话内容,按顺序分别加载模型、加载文档、进行提问

cocomany @.***>于2023年4月14日 周五23:37写道:

运行 webui.py后能访问页面,上传一个md文件后,日志中有错误。等待后能加载完成,提示可以提问了,但提问没反应,日志中有错误。 具体日志如下。

$ python webui.py /data/py310/lib/python3.10/site-packages/gradio/components.py:167: UserWarning: Unknown style parameter: height warnings.warn(f"Unknown style parameter: {key}") Running on local URL: http://0.0.0.0:7860

To create a public link, set share=True in launch(). Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision. Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision. Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision. Loading checkpoint shards: 12%|█████████████▉ | 1/8 [00:09<01:04, 9.22s/it][nltk_data] Downloading package punkt to /home/ubuntu/nltk_data... [nltk_data] Unzipping tokenizers/punkt.zip. [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /home/ubuntu/nltk_data... [nltk_data] Unzipping taggers/averaged_perceptron_tagger.zip. langchain-ChatGLM README.md 已成功加载 Traceback (most recent call last): File "/data/py310/lib/python3.10/site-packages/gradio/routes.py", line 401, in run_predict output = await app.get_blocks().process_api( File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1302, in process_api result = await self.call_function( File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1025, in call_function prediction = await anyio.to_thread.run_sync( File "/data/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, args) File "/data/github/langchain-ChatGLM/webui.py", line 121, in kb.init_knowledge_vector_store( File "/data/github/langchain-ChatGLM/knowledge_based_chatglm.py", line 73, in init_knowledge_vector_store vector_store = FAISS.from_documents(docs, embeddings) NameError: name 'embeddings' is not defined Loading checkpoint shards: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [01:37<00:00, 12.16s/it]Downloading (…)58aa3/.gitattributes: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 1.48k/1.48k [00:00<00:00, 1.50MB/s]Downloading (…)026ff58aa3/README.md: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 317/317 [00:00<00:00, 295kB/s]Downloading (…)6ff58aa3/config.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 821/821 [00:00<00:00, 871kB/s]Downloading (…)aa3/eval_results.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 69.0/69.0 [00:00<00:00, 72.1kB/s]Downloading pytorch_model.bin: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 1.30G/1.30G [00:03<00:00, 421MB/s]Downloading (…)cial_tokens_map.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 125/125 [00:00<00:00, 114kB/s]Downloading (…)58aa3/tokenizer.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 439k/439k [00:00<00:00, 78.6MB/s]Downloading (…)okenizer_config.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 514/514 [00:00<00:00, 529kB/s]Downloading (…)026ff58aa3/vocab.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 110k/110k [00:00<00:00, 61.1MB/s]No sentence-transformers model found with name /home/ubuntu/.cache/torch/sentence_transformers/GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling. No sentence-transformers model found with name /home/ubuntu/.cache/torch/sentence_transformers/GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling. Traceback (most recent call last): File "/data/py310/lib/python3.10/site-packages/gradio/routes.py", line 401, in run_predict output = await app.get_blocks().process_api( File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1302, in process_api result = await self.call_function( File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1025, in call_function prediction = await anyio.to_thread.run_sync( File "/data/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, args) File "/data/github/langchain-ChatGLM/webui.py", line 31, in get_answer resp, history = kb.get_knowledge_based_answer( File "/data/github/langchain-ChatGLM/knowledge_based_chatglm.py", line 95, in get_knowledge_based_answer retriever=vector_store.as_retriever(search_kwargs={"k": VECTOR_SEARCH_TOP_K}), AttributeError: 'NoneType' object has no attribute 'as_retriever' Traceback (most recent call last): File "/data/py310/lib/python3.10/site-packages/gradio/routes.py", line 401, in run_predict output = await app.get_blocks().process_api( File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1302, in process_api result = await self.call_function( File "/data/py310/lib/python3.10/site-packages/gradio/blocks.py", line 1025, in call_function prediction = await anyio.to_thread.run_sync( File "/data/py310/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/data/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/data/github/langchain-ChatGLM/webui.py", line 31, in get_answer resp, history = kb.get_knowledge_based_answer( File "/data/github/langchain-ChatGLM/knowledge_based_chatglm.py", line 95, in get_knowledge_based_answer retriever=vector_store.as_retriever(search_kwargs={"k": VECTOR_SEARCH_TOP_K}), AttributeError: 'NoneType' object has no attribute 'as_retriever'

— Reply to this email directly, view it on GitHub https://github.com/imClumsyPanda/langchain-ChatGLM/issues/98, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLH5EXBXLCSBJHJXT7BPQLXBFVNJANCNFSM6AAAAAAW6SPTHY . You are receiving this because you are subscribed to this thread.Message ID: @.***>