frostmiku / chatglm-langchain Goto Github PK
View Code? Open in Web Editor NEWChatGLM 6B 的模型与UI,通过 LangChain 与向量匹配实现本地知识库问答,支持流式输出
ChatGLM 6B 的模型与UI,通过 LangChain 与向量匹配实现本地知识库问答,支持流式输出
请问出现下面错误是为什么呢?
no sentence-transformers model found with name /home/hc/.cache/torch/sentence_transformers/GanymedeNil_text2vec-large-chinese. Creating a new one with MEAN pooling.
demo.md 未能成功加载
2023-05-21 16:39:31.580 Uncaught app exception
Traceback (most recent call last):
File "/home/hc/anaconda3/envs/zwtpy39/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/home/hc/zwt/qa/ChatGLM-LangChain-main/ui.py", line 47, in
st.session_state.vecdb = init_knowledge_vector_store(
File "/home/hc/zwt/qa/ChatGLM-LangChain-main/utils.py", line 48, in init_knowledge_vector_store
vector_store = FAISS.from_documents(docs, embeddings)
File "/home/hc/anaconda3/envs/zwtpy39/lib/python3.10/site-packages/langchain/vectorstores/base.py", line 218, in from_documents
return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File "/home/hc/anaconda3/envs/zwtpy39/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 368, in from_texts
return cls.__from(
File "/home/hc/anaconda3/envs/zwtpy39/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 330, in __from
index = faiss.IndexFlatL2(len(embeddings[0]))
IndexError: list index out of range
算了下 134217728 bytes只合约128M内存,辛苦大佬帮忙看下
(langc) PS G:\files\dev\ChatGLM-LangChain> streamlit run ui.py --browser.gatherUsageStats False
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://10.168.78.14:8501
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.
Symbol cudaLaunchKernel not found in C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\cudart64_65.dll
2023-07-18 10:18:44.397 Uncaught app exception
Traceback (most recent call last):
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 263, in _get_or_create_cached_value
cached_result = cache.read_result(value_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_resource_api.py", line 500, in read_result
raise CacheKeyNotFoundError()
streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 311, in _handle_cache_miss
cached_result = cache.read_result(value_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_resource_api.py", line 500, in read_result
raise CacheKeyNotFoundError()
streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "G:\files\dev\ChatGLM-LangChain\ui.py", line 41, in <module>
tokenizer, model, embeddings = get_model()
^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 211, in wrapper
return cached_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 240, in __call__
return self._get_or_create_cached_value(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 266, in _get_or_create_cached_value
return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 320, in _handle_cache_miss
computed_value = self._info.func(*func_args, **func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\files\dev\ChatGLM-LangChain\ui.py", line 24, in get_model
model = AutoModel.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\transformers\models\auto\auto_factory.py", line 459, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\transformers\modeling_utils.py", line 2362, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\will/.cache\huggingface\modules\transformers_modules\silver\chatglm-6b-int4-slim\c9ec05795cbcdd8be88b1c7b4e6a53db24477bc5\modeling_chatglm.py", line 1019, in __init__
self.transformer = ChatGLMModel(config)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\will/.cache\huggingface\modules\transformers_modules\silver\chatglm-6b-int4-slim\c9ec05795cbcdd8be88b1c7b4e6a53db24477bc5\modeling_chatglm.py", line 825, in __init__
[get_layer(layer_id) for layer_id in range(self.num_layers)]
File "C:\Users\will/.cache\huggingface\modules\transformers_modules\silver\chatglm-6b-int4-slim\c9ec05795cbcdd8be88b1c7b4e6a53db24477bc5\modeling_chatglm.py", line 825, in <listcomp>
[get_layer(layer_id) for layer_id in range(self.num_layers)]
^^^^^^^^^^^^^^^^^^^
File "C:\Users\will/.cache\huggingface\modules\transformers_modules\silver\chatglm-6b-int4-slim\c9ec05795cbcdd8be88b1c7b4e6a53db24477bc5\modeling_chatglm.py", line 811, in get_layer
return GLMBlock(
^^^^^^^^^
File "C:\Users\will/.cache\huggingface\modules\transformers_modules\silver\chatglm-6b-int4-slim\c9ec05795cbcdd8be88b1c7b4e6a53db24477bc5\modeling_chatglm.py", line 586, in __init__
self.mlp = GLU(
^^^^
File "C:\Users\will/.cache\huggingface\modules\transformers_modules\silver\chatglm-6b-int4-slim\c9ec05795cbcdd8be88b1c7b4e6a53db24477bc5\modeling_chatglm.py", line 521, in __init__
self.dense_4h_to_h = skip_init(
^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\torch\nn\utils\init.py", line 52, in skip_init
return module_cls(*args, **kwargs).to_empty(device=final_device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\torch\nn\modules\module.py", line 1024, in to_empty
return self._apply(lambda t: torch.empty_like(t, device=device))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\torch\nn\modules\module.py", line 820, in _apply
param_applied = fn(param)
^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\torch\nn\modules\module.py", line 1024, in <lambda>
return self._apply(lambda t: torch.empty_like(t, device=device))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\langc\Lib\site-packages\torch\_refs\__init__.py", line 4254, in empty_like
return torch.empty_strided(
^^^^^^^^^^^^^^^^^^^^
RuntimeError: [enforce fail at ..\c10\core\impl\alloc_cpu.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 134217728 bytes.
疑似是UnstructuredFileLoader这个方法的问题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.