My code below causes the error TypeError: _load_sbert_model() got an unexpected keyword argument 'token' while I try to run it. This is the same code in the documentation for Langchain Instruct Embeddings but I can't seem to get it right.
from langchain_community.embeddings import HuggingFaceInstructEmbeddings, HuggingFaceEmbeddings from langchain.embeddings import HuggingFaceInstructEmbeddings from InstructorEmbedding import INSTRUCTOR from langchain.vectorstores import FAISS
embeddings = HuggingFaceInstructEmbeddings()
TypeError: _load_sbert_model() got an unexpected keyword argument 'token'
I have tried using other text similarity models like sentence-transformers/all-MiniLM-L6-v2 but when I try to run the line FAISS.from_documents(documents=data, embedding=instructor_embeddings) it causes an attribute error
The following commands fixed the issue, I do not need to change langchain version.
pip uninstall sentence-transformers
pip install sentence-transformers==2.2.2
Due to recent changes in sentence transformer package this issue is coming up. Try using the below version.
!pip install langchain==0.1.2 sentence_transformers==2.2.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With