Skip to content
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

[ERROR]: TypeError in M3Embedder.encode(): Missing required argument 'queries' #2846

Open
1 task done
calnick1 opened this issue Nov 1, 2024 · 1 comment
Open
1 task done

Comments

@calnick1
Copy link

calnick1 commented Nov 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

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

  1. Import the necessary modules
    pip install --upgrade pymilvus
    pip install "pymilvus[model]"

  2. Create an M3Embedder object

  3. Attempt to encode documents using encode_documents method

Code Sample

from pymilvus.model.hybrid import BGEM3EmbeddingFunction

bge_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)


from pymilvus.model.hybrid import BGEM3EmbeddingFunction

bge_m3_ef = BGEM3EmbeddingFunction(
    model_name='BAAI/bge-m3', # Specify the model name
    device='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)
@unsw-luopan
Copy link

Same error, solved by pip intall FlagEmbedding==1.2.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants