-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
Obtaining an embeddings vector for a larger text #2712
Comments
The |
Thank you very much. It works with that patch! 👍 |
Hi guys @s-trooper @slaren, sorry to ask this question here but after converting my text to vectors what do I do with the outputs, does it get saved somewhere? How can I use it with llama.cpp I cannot seem to find much information about embedding using the llama.cpp, many thanks in advance. I generate output the following way: ./llama.cpp/embedding -ngl 0 -c 4096 -m ../models/vicuna-7b-v1.5.ggmlv3.q5_1.bin -f ~/test.txt |
Hello @deonis1, on Windows, when I redirect/write the output to a file, only the vector is written to the file and not the informational text. I can't test it on Linux, but try it out yourself. I assume many people use "llama-cpp-python" for embedding. I haven't been able to get it to work myself yet. But if you can, here's the API: from llama_cpp import Llama
llm = Llama(model_path=r".\models\ggml-vic13b-q5_1.bin", embedding=True)
output = llm.create_embedding(open("./embedding-test.txt").read())
emb_vector = output['data'][0]['embedding'] |
Hi @s-trooper, thank you for the reply. I use pure C or node-js, I am building a small chat application for local llms (https://github.com/deonis1/llcui) in nodejs and wanted to incorporate embedding. Looks like server application in llama.cpp supports embedding but I have not tried it yet. I might need to dig through the code to see what makes it tick. |
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
I would like to obtain an embedding vector for larger texts, e.g. 4K, 8K or more.
Current Behavior
I get an error:
ggml_new_object: not enough space in the context's memory pool (needed 12747504, available 12747472)
Environment and Context
When I create a text file with 197 lines of "Hello World", like:
I get the embedding vector as expected.
However, when I add just one more line, I receive the error
not enough space in the context's memory pool.
Yet, my RAM/VRAM is being used less than 15%!
I know there are many issues related to this error, but I haven't found any solution for embeddings.
Physical (or virtual) hardware you are using, e.g. for Linux:
Operating System, e.g. for Linux:
Failure Information (for bugs)
ggml_new_object: not enough space in the context's memory pool (needed 12747504, available 12747472)
Steps to Reproduce
Failure Logs
Example run with the Windows command embedding
The text was updated successfully, but these errors were encountered: