How to make HuggingfaceEmbeddings use local model? #14115
Replies: 4 comments 6 replies
-
🤖 Hello @RedNoseJJN, Good to see you again! I hope you're doing well. I noticed your recent issue and I'm here to help. Based on the information you've provided, it seems like you're trying to use a local model with the from langchain.embeddings import HuggingFaceEmbeddings
# Path to your local model
local_model_path = "/path/to/your/local/model"
# Instantiate the HuggingFaceEmbeddings class
embedding = HuggingFaceEmbeddings(model_name=local_model_path)
# Use the embedding instance
documents = ["foo bar"]
output = embedding.embed_documents(documents) In this example, replace Please note that the local model must be compatible with the HuggingFace's Transformers library, as the If you're still encountering issues, could you please provide the exact error message you're receiving? This will help in diagnosing the problem. Also, please ensure that the For more information, you can refer to the LangChain repository and the related issue where a similar problem was solved. I hope this helps! If you have any other questions, feel free to ask. 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. |
Beta Was this translation helpful? Give feedback.
-
I am still facing issues while loading local model into HuggingfaceEmbeddings , can anyone please provide a stepwise guide to how to do it. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Has this been resolved yet? |
Beta Was this translation helpful? Give feedback.
-
i am experiencing similar issue and getting this error when loading the model from local disk by passing the path as param. Any idea? HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '../models/bge-small-en-v15'. Use
|
Beta Was this translation helpful? Give feedback.
-
Last week, the function can still work, when I use the HuggingfaceEmbeddings with the relative path of my local model, I can run it and get the embedding result. But just now, when I try to run another program, it no longer works. It will raise an exception saying the network is unreachable. Seems it is trying to access to the model on the hub, I tried to use the absolute path, but still can not solve it.
I wonder how can I use local model when I know it is impossible to access the huggingface hub?
Beta Was this translation helpful? Give feedback.
All reactions