Langchain-Chatchat icon indicating copy to clipboard operation
Langchain-Chatchat copied to clipboard

加载txt文件失败?

Open cristianohello opened this issue 1 year ago • 6 comments

JppHrGOWFa

cristianohello avatar Apr 14 '23 09:04 cristianohello

支持.txt,不支持. txt

cristianohello @.***>于2023年4月14日 周五17:43写道:

[image: JppHrGOWFa] https://user-images.githubusercontent.com/109277248/232009383-bf7c46d1-a01e-4e0a-9de6-5b5ed3e36158.jpg

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

imClumsyPanda avatar Apr 14 '23 09:04 imClumsyPanda

@imClumsyPanda 我确定是.txt。是不是内容不能有什么特殊符号,比如表情符号??

cristianohello avatar Apr 14 '23 10:04 cristianohello

@imClumsyPanda

est.txt 未能成功加载 .ipynb_checkpoints 未能成功加载 ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /root/autodl-tmp/chatglm/langchain-ChatGLM-master/knowledge_based_chatglm.py:114 in │ │ │ │ 111 │ vector_store = None │ │ 112 │ while not vector_store: │ │ 113 │ │ filepath = input("Input your local knowledge file path 请输入本地知识文件路径:" │ │ ❱ 114 │ │ vector_store = init_knowledge_vector_store(filepath) │ │ 115 │ history = [] │ │ 116 │ while True: │ │ 117 │ │ query = input("Input your question 请输入问题:") │ │ │ │ /root/autodl-tmp/chatglm/langchain-ChatGLM-master/knowledge_based_chatglm.py:73 in │ │ init_knowledge_vector_store │ │ │ │ 70 │ │ │ except: │ │ 71 │ │ │ │ print(f"{file} 未能成功加载") │ │ 72 │ │ │ ❱ 73 │ vector_store = FAISS.from_documents(docs, embeddings) │ │ 74 │ return vector_store │ │ 75 │ │ 76 │ │ │ │ /root/miniconda3/envs/chatglm20230401/lib/python3.9/site-packages/langchain/vectorstores/base.py │ │ :116 in from_documents │ │ │ │ 113 │ │ """Return VectorStore initialized from documents and embeddings.""" │ │ 114 │ │ texts = [d.page_content for d in documents] │ │ 115 │ │ metadatas = [d.metadata for d in documents] │ │ ❱ 116 │ │ return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs) │ │ 117 │ │ │ 118 │ @classmethod │ │ 119 │ @abstractmethod │ │ │ │ /root/miniconda3/envs/chatglm20230401/lib/python3.9/site-packages/langchain/vectorstores/faiss.p │ │ y:345 in from_texts │ │ │ │ 342 │ │ │ │ faiss = FAISS.from_texts(texts, embeddings) │ │ 343 │ │ """ │ │ 344 │ │ embeddings = embedding.embed_documents(texts) │ │ ❱ 345 │ │ return cls.__from(texts, embeddings, embedding, metadatas, **kwargs) │ │ 346 │ │ │ 347 │ @classmethod │ │ 348 │ def from_embeddings( │ │ │ │ /root/miniconda3/envs/chatglm20230401/lib/python3.9/site-packages/langchain/vectorstores/faiss.p │ │ y:307 in __from │ │ │ │ 304 │ │ **kwargs: Any, │ │ 305 │ ) -> FAISS: │ │ 306 │ │ faiss = dependable_faiss_import() │ │ ❱ 307 │ │ index = faiss.IndexFlatL2(len(embeddings[0])) │ │ 308 │ │ index.add(np.array(embeddings, dtype=np.float32)) │ │ 309 │ │ documents = [] │ │ 310 │ │ for i, text in enumerate(texts): │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ IndexError: list index out of range

cristianohello avatar Apr 14 '23 10:04 cristianohello

@imClumsyPanda

MIME type was application/csv. This file type is not currently supported in unstructured. test.txt 未能成功加载

cristianohello avatar Apr 14 '23 10:04 cristianohello

我也遇到了,应该是文件里有什么特殊字符。把文字复制粘贴一次临时解决了。

ackerx avatar Apr 14 '23 13:04 ackerx

我也遇到了,应该是文件里有什么特殊字符。把文字复制粘贴一次临时解决了。

请问一下这个txt格式有要求吗?

Sauloo-huen avatar Apr 18 '23 08:04 Sauloo-huen

同样遇到这个问题,我甚至不知道是哪里出的问题,因为本文是在太长了,不知道有什么不合规的特殊符号。follow一下这个问题后续

LXXiaogege avatar Sep 09 '23 04:09 LXXiaogege

目前已知的是特殊字符的问题,太长的文本不影响。

zRzRzRzRzRzRzR avatar Sep 27 '23 13:09 zRzRzRzRzRzRzR

上传文件时什么文件都上传不了报错AxiosError: Request failed with status code 403!这个有什么办法解决吗

snowwalkk avatar Mar 11 '24 07:03 snowwalkk