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
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
The text was updated successfully, but these errors were encountered:
### What this PR does:
Fixes a bug in `examples/milvus_model/hello_model.py` where indexing a
sparse matrix with `x[0]` caused a `NotImplementedError`.
### Changes made:
- Updated the sparse matrix indexing from `x[0]` to `x[:, [0]]` to use
explicit 2D indexing, which is supported.
Signed-off-by: jinjuan zhou <[email protected]>
Co-authored-by: jinjuan zhou <[email protected]>
Is there an existing issue for this?
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
Environment details
Anything else?
no
The text was updated successfully, but these errors were encountered: