-
Notifications
You must be signed in to change notification settings - Fork 389
Open
Labels
kind/bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When running the script examples/milvus_model/hello_model.py with the sparse vector model example, I encountered the following error:
NotImplementedError: We have not yet implemented 1D sparse slices; please index using explicit indices, e.g. x[:, [0]]
Expected Behavior
The script should execute successfully and return the expected results for sparse vector operations.
Steps/Code To Reproduce behavior
from pymilvus.model.sparse import BM25EmbeddingFunction, SpladeEmbeddingFunction
from pymilvus.model.hybrid import BGEM3EmbeddingFunction
fmt = "=== {:30} ==="
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.",
]
# BM25EmbeddingFunction usage
print(fmt.format("BM25EmbeddingFunction Usage"))
ef_bm25 = BM25EmbeddingFunction()
ef_bm25.load()
embs_bm25 = ef_bm25.encode_documents(docs)
print(f"Embedding Shape: {embs_bm25[0].shape} Dimension: {ef_bm25.dim}")
# -----------------------------------------------------------------------------
# SpladeEmbeddingFunction usage
print(fmt.format("SpladeEmbeddingFunction Usage"))
ef_splade = SpladeEmbeddingFunction(device="cpu")
embs_splade = ef_splade(["Hello world", "Hello world2"])
print(f"Embedding Shape: {embs_splade[0].shape} Dimension: {ef_splade.dim}")Environment details
- Hardware/Softward conditions (OS, CPU, GPU, Memory):cpu
- Method of installation (Docker, or from source):source
- Milvus version (v0.3.1, or v0.4.0):2.5.0
- Milvus configuration (Settings you made in `server_config.yaml`):Anything else?
no
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working