-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
INSTRUCTOR models not working with sentence-transformers via langchain #2567
Comments
Hello! The issue originates in https://github.com/xlang-ai/instructor-embedding, which was created explicitly for Sentence Transformers A good solution would be to try this PR: xlang-ai/instructor-embedding#112 with:
and the most recent sentence-transformers. That combination should work correctly.
|
Thanks, I checked it out. Now I'm getting the error below. My program downloads the instructor models into a specific directory. It does not use the default "cache" location. I do this for various reasons. As such, I specify the path to the model rather than the Huggingface repo ID when instantiating the model...I'm guessing this is the reason why I'm getting this error...Any clue?
|
I resolved this error by using the huggingface repo id instead:
I'm guessing this IS NOT a true fix, however, since I notice that the "_load_sbert_model" method within
To temporarily obviate the issue I simply tried "hkunlp/instructor-base" instead of "embedding_model_name"...I did this to get to the next troubleshooting step for the time being... IT WORKED! The database was successfully created. MOREOVER, I was able to successfully search it! SUMMARY: The script provided at https://github.com/SilasMarvin/instructor-embedding/tree/silas-update-for-newer-sentence-transformers fixes the error Question: Are you willing to modify It seems to me (as a lay person) that you'd simply need to have an intermediary function between how the Basically, even though it's the The benefit would be that Instructor models would work with newer versions of the Thanks again. Please let me know if there's a way I can contribute. |
FINALLY, regarding the error of not being able to load a model locally, I finally solved this issue by using the I assume that this connects with the https://www.sbert.net/docs/package_reference/SentenceTransformer.html So this narrow issue, at least, seems solved. Just thought others might want to know. |
The fix for this just got merged into Instructor Embedding: xlang-ai/instructor-embedding@5cca65e |
This is a challenging issue that I've been working on...First, here is my entire script:
SCRIPT
This works fine when using
sentence-transformers==2.2.2
. However, when I upgrade tosentence-transformers==2.6.1
I get this error:ERROR
I've verified that when using a
BGE
model (viaHuggingFaceBgeEmbeddings
),GTE
model (viaHuggingFaceEmbeddings
) andall-mpnet-base-v2
(viaHuggingFaceEmbeddings
) everything works fine. I've tried every which way to get it to work...Since I really like the "instructor" models in my program, this forces me to stay at
sentence-transformers==2.2.2
or, alternatively, abandon them in order to upgrade so I can use newer models (e.g.mxbai-embed-large-v1
). I wouldn't normally ask, but I've spend dozens of hours trying to solve this...ranging from usingSentenceTransformers
directly pursuant to the API on your website to custom wrappers, etc.Can anyone help me and/or @tomaarsen in particular if he has time? I don't know if this is an issue for
sentence-transformers
itself, its integration withHuggingFaceInstructEmbeddings
from Langchain, or just my code...Thanks in advance![EDIT] I am aware that Instructor models are unique in that the prompt is not included in pooling, as stated on your website's instructions/examples, and I DID examine
SentenceTransformers
itself and see where you took that into account:(taken from version 2.6.0)
I just simply can't figure out why
HuggingFaceInstructEmbeddings
isn't working whileHuggingFaceEmbeddings
andHuggingFaceBgeEmbeddings
work fine when I pip install sentence-transformers above 2.2.2...This is literally the only issue that has stymied my program from upgrading the crucial dependency that is
sentence-transformers
...Thanks again and love the repo!The text was updated successfully, but these errors were encountered: