Replies: 2 comments
-
🤖 Hello, Thank you for reaching out and for your interest in LangChain. The warning you're seeing is due to the fact that the HuggingFaceEmbeddings class in LangChain is designed to work with 'sentence-transformers' models. When you provide a model name that doesn't start with 'sentence-transformers', the class attempts to create a new 'sentence-transformers' model with MEAN pooling. This is why you're seeing the warning message. While you can technically use a Hugging Face "transformer" class model with the HuggingFaceEmbeddings API in LangChain, it's important to note that the quality of the embeddings will depend on the specific transformer model you're using. If the model is not originally a 'sentence-transformers' model, the embeddings might not be as good as they could be. If you're looking to use models from the "transformers" class, LangChain also includes a separate class, HuggingFacePipeline, which does support these models. This class is used for tasks such as text-generation, text2text-generation, and summarization. It uses the You can find more information about these classes in the LangChain repository: I hope this helps! If you have any other questions, feel free to ask. Best, 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.
-
@dosu-bot |
Beta Was this translation helpful? Give feedback.
-
Good day,
I'm working on an application that requires embedding for Non-English languages (for the purpose of Q&A context / similarity matching).
According to API doc for HuggingFaceEmbeddings, the model need to be a Hugging Face sentence_transformers model.
However, I've identified a preferred model of class "transformer" & tried using it with the code below:
This seems to work as embedding values are being generated - but I also get this warning:
Is this something to worry about? Will using the API this way yields crappy embedding?
Appreciate any guidance on this topic!
Beta Was this translation helpful? Give feedback.
All reactions