Hello, While trying to use the new HuggingFaceLLM function with the Vector Store Index I get the following error: 'HuggingFaceLLM' object has no attribute 'predict' Does anyone have an answer to this ? I'm following this tutorial: https://gpt-index.readthedocs.io/en/v0.7.0/examples/customization/llms/SimpleIndexDemo-Huggingface_camel.html Also I've added embedding in the service context using LangChainEmbedding since I was getting an Open AI API key error Thanks
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext, LangchainEmbedding from llama_index.llms import HuggingFaceLLM from llama_index.prompts.prompts import SimpleInputPrompt
query_wrapper_prompt = SimpleInputPrompt( "Below is an instruction that describes a task. " "Write a response that appropriately completes the request.\n\n" "### Instruction:\n{query_str}\n\n### Response:" ) import torch llm = HuggingFaceLLM( # context_window=2048, Returns an error message # max_new_tokens=256, temperature=0.25, do_sample=False, query_wrapper_prompt=query_wrapper_prompt, tokenizer_name="Writer/camel-5b-hf", model_name="Writer/camel-5b-hf", device_map="auto", tokenizer_kwargs={"max_length": 2048}, model_kwargs={"torch_dtype": torch.float16} )
from langchain.embeddings import HuggingFaceEmbeddings embed_model = LangchainEmbedding(HuggingFaceEmbeddings(model_name = "sentence-transformers/all-mpnet-base-v2")) #I get an Open AI API error without
that error makes no sense to me, at least from a code perspective.
I'm not able to replicate either π Can you try either updating to the latest version, or just for a sanity check, wrap the llm with the predictor class
It does! Assuming the model from huggingface is a text-generation model π Some models will require different prompt settings and context window settings, which can hopefully be found in the model card or config.json files