'JinaBertModel' object has no attribute 'embed_documents'

#22
by herMaster - opened

I tried to use this model for document embedding -
model = AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-en', trust_remote_code=True)
embedding = model

vectordb = Chroma.from_documents(documents=texts,
embedding=embedding,
persist_directory=persist_directory)

But got the error.

Yes, you are right. But how to decide which wrapper to use for which model? Or, what was wrong with AutoModel?
Sorry if it's a very dumb question. I am a beginner.
Thank you.

I used the wrapper you said, but now I am getting the embedding_function error in chromadb. I did -

loaded the jina model -

from langchain.embeddings import HuggingFaceEmbeddings

model_name = "jinaai/jina-embeddings-v2-base-en"
model_kwargs = {'device': 'cuda'}
encode_kwargs = {'normalize_embeddings': True}
model = HuggingFaceEmbeddings(
model_name=model_name,
model_kwargs=model_kwargs,
encode_kwargs=encode_kwargs
)

chroma settings -

from chromadb.config import Settings

CHROMA_SETTINGS = Settings(
anonymized_telemetry=False,
is_persistent=True,
)

Creating the persist directory -

persist_directory = 'db'

Here is the new embeddings being used

embedding = model

vectordb = Chroma.from_documents(documents=texts,
embedding=embedding,
persist_directory=persist_directory,
client_settings=CHROMA_SETTINGS)

error in above step -

Expected EmbeddingFunction.call to have the following signature: odict_keys(['self', 'input']), got odict_keys(['self', 'args', 'kwargs'])

Jina AI org

hi, we implemented an encode function together with the model, i'm not sure about Chroma, seems this is a 3rd party integration issue.

Jina AI org

Hey @herMaster , this seems more like a langchain thing than something on our end. Maybe try asking in their Discord channel?

Okay, guys. I will try to ask on their discord. I am closing this discussion for now. Thank you for your help.

herMaster changed discussion status to closed

Sign up or log in to comment