You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempt to encode documents using encode_documents method
Code Sample
frompymilvus.model.hybridimportBGEM3EmbeddingFunctionbge_m3_ef=BGEM3EmbeddingFunction(
model_name='BAAI/bge-m3',
device='cpu',
use_fp16=False
)
docs= ["Your document text here"]
docs_embeddings=bge_m3_ef.encode_documents(docs)
frompymilvus.model.hybridimportBGEM3EmbeddingFunctionbge_m3_ef=BGEM3EmbeddingFunction(
model_name='BAAI/bge-m3', # Specify the model namedevice='cpu', # Specify the device to use, e.g., 'cpu' or 'cuda:0'use_fp16=False# Specify whether to use fp16. Set to `False` if `device` is `cpu`.
)
docs= [
"Artificial intelligence was founded as an academic discipline in 1956.",
"Alan Turing was the first person to conduct substantial research in AI.",
"Born in Maida Vale, London, Turing was raised in southern England.",
]
docs_embeddings=bge_m3_ef.encode_documents(docs)
print("Embeddings:", docs_embeddings)
print("Dense document dim:", bge_m3_ef.dim["dense"], docs_embeddings["dense"][0].shape)
print("Sparse document dim:", bge_m3_ef.dim["sparse"], list(docs_embeddings["sparse"])[0].shape)
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Issue
I'm encountering a TypeError when trying to use the M3Embedder to encode documents. Tried with pymilvus==2.4.0, 2.4.8, 2.4.9
Steps to Reproduce
Import the necessary modules
pip install --upgrade pymilvus
pip install "pymilvus[model]"
Create an M3Embedder object
Attempt to encode documents using
encode_documents
methodCode Sample
The text was updated successfully, but these errors were encountered: