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

[Question]: Can a locally stored TensorFlow model be used with llamaindex? #8201

Closed
1 task done
iriye opened this issue Oct 19, 2023 · 2 comments
Closed
1 task done
Labels
question Further information is requested

Comments

@iriye
Copy link

iriye commented Oct 19, 2023

Question Validation

  • I have searched both the documentation and discord for an answer.

Question

Can a locally stored TensorFlow model be used with llamaindex?

@iriye iriye added the question Further information is requested label Oct 19, 2023
@dosubot
Copy link

dosubot bot commented Oct 19, 2023

🤖

Yes, a locally stored TensorFlow model can be used with LlamaIndex. There are a few ways to do this based on the similar issues I found in the LlamaIndex repository.

  1. You can load the model and tokenizer directly as kwargs if you can load them outside of the huggingface LLM. Alternatively, you can implement a custom LLM class. More information on how to do this can be found here. This solution was suggested in the issue Querying Index using local models with no access to download from the hub(s).

  2. LlamaIndex can be used with locally hosted model services that simulate OpenAI's API. You can customize your LLM model as per the example provided in the documentation at https://gpt-index.readthedocs.io/en/latest/how_to/customization/custom_llms.html#example-using-a-custom-llm-model. The code pipeline = pipeline("text-generation", model=model_name, device="cuda:0", model_kwargs={"torch_dtype":torch.bfloat16}) is used to create a pipeline for text generation using the specified model, and it runs on the CUDA device with the specified torch data type. This solution was suggested in the issue run llama_index with locally llm that have compatible OpenAI's API.

  3. You can use langchain as the underlying LLM abstraction under the hood. You should follow the langchain docs for how to add a custom llm. This solution was suggested in the issue Can I use llama-index based on a locally deployed model?. However, the provided link to the documentation is not working (404 error), so you will need to find the correct documentation or contact the creators for the correct link.

Please let me know if you need further assistance.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@logan-markewich
Copy link
Collaborator

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

No branches or pull requests

2 participants