Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentence transformers error? #1

Open
anqin opened this issue Aug 7, 2024 · 0 comments
Open

Sentence transformers error? #1

anqin opened this issue Aug 7, 2024 · 0 comments

Comments

@anqin
Copy link

anqin commented Aug 7, 2024

I tried to run the app follow the README, however I got the follow error.

Not sure whether it come from the sentence transformer, since it is missed in the requirement.txt. So I run pip to install the missing packages.

================ LOG for run ============
$ gunicorn -b 0.0.0.0:8080 app:app
[2024-08-07 17:21:29 +0800] [16314] [INFO] Starting gunicorn 21.2.0
[2024-08-07 17:21:29 +0800] [16314] [INFO] Listening at: http://0.0.0.0:8080 (16314)
[2024-08-07 17:21:29 +0800] [16314] [INFO] Using worker: sync
[2024-08-07 17:21:29 +0800] [16315] [INFO] Booting worker with pid: 16315
Init Search

/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/transformers/tokenization_utils_base.py:1601: FutureWarning: clean_up_tokenization_spaces was not set. It will be set to True by default. This behavior will be depracted in transformers v4.45, and will be then set to False by default. For more details check this issue: huggingface/transformers#31884
warnings.warn(
[2024-08-07 17:22:00,910] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/flask/app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/c/workspace/github/sova_ollama/app.py", line 87, in index
context = get_context(query)
^^^^^^^^^^^^^^^^^^
File "/mnt/c/workspace/github/sova_ollama/app.py", line 43, in get_context
db = Chroma.from_texts(documents, embedding=embeddings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/langchain_community/vectorstores/chroma.py", line 742, in from_texts
chroma_collection.add_texts(texts=texts, metadatas=metadatas, ids=ids)
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/langchain_community/vectorstores/chroma.py", line 275, in add_texts
embeddings = self._embedding_function.embed_documents(texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/langchain_community/embeddings/huggingface.py", line 93, in embed_documents
embeddings = self.client.encode(
^^^^^^^^^^^^^^^^^^^
File "/home/anqin/miniconda3/envs/sova/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py", line 565, in encode
if all_embeddings[0].dtype == torch.bfloat16:
~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant