-
Notifications
You must be signed in to change notification settings - Fork 4.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
[Bug]: Issues with llama_index.core #13453
Comments
To address the issues with
By following these steps, you should be able to resolve the errors related to
|
@Wung8 you aren't using the LlamaCPP llm class, so none of the methods will work Install the integration
Then something like from llama_index.llms.llama_cpp import LlamaCPP
llm = LlamaCPP(
# You can pass in the URL to a GGML model to download it automatically
model_url=model_url,
# optionally, you can set the path to a pre-downloaded model instead of model_url
model_path=None,
temperature=0.1,
max_new_tokens=256,
context_window=3900,
# kwargs to pass to __call__()
generate_kwargs={},
# kwargs to pass to __init__()
# set to at least 1 to use GPU
model_kwargs={"n_gpu_layers": -1},
# transform inputs into Llama3 format
messages_to_prompt=messages_to_prompt,
completion_to_prompt=completion_to_prompt,
verbose=True,
) Since llamacpp does not handle any prompt formatting, messages_to_prompt and completion_to,_prompt are functions passed in to handle formatting a single a completion (I.e. a single string) or a list of messages into the expected format.
Tbh I would just use ollama though, the setup is much easier, and it handles the prompt formatting |
@logan-markewich I tried to use Ollama earlier, but ran into a WinError and tried using llama-cpp instead, but after reading your response I will try to switch back.
Okay, let's see... The Self-Referential Snafu [] A rule is embedded within these brackets. How's your head doing after reading this nomic-embed-text? |
Bug Description
Recently I installed llama-cpp and llama-index, and while llama-cpp seems to work, I keep getting error messages from llama-index-core. First it was an error with llm_metadata in llama_index\core\indices\prompt_helper.py, and then it was an issue with _llm in llama_index\core\response_synthesizers\refine.py. I've tried installing different versions of llama-index and using a venv but nothing seems to work. What could be the issue?
Version
0.10.36
Steps to Reproduce
install most recent versions of the libraries
Code:
`from llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id=r"QuantFactory/Meta-Llama-3-8B-Instruct-GGUF",
filename=r"Meta-Llama-3-8B-Instruct.Q6_K.gguf",
verbose=False
)
def prompt():
usr = input("usr-")
#while True:
prompt()
import os
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.core import Settings, VectorStoreIndex, SimpleDirectoryReader
from llama_index.embeddings.ollama import OllamaEmbedding
from llama_index.llms.ollama import Ollama
embed_model = HuggingFaceEmbedding(model_name="nomic-ai/nomic-embed-text-v1.5", trust_remote_code=True)
Settings.llm = llm
Settings.embed_model = embed_model
#Settings.context_window = 256000
documents = SimpleDirectoryReader("./HexEmpire").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
def query():
usr = input("usr-")
response = query_engine.query(usr)
print(response)
return response
while True:
query()
`
Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: