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

Add friendly setup instructions to hello_hybrid_sparse_dense.py #1995

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions examples/hello_hybrid_sparse_dense.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# A demo showing hybrid semantic search with dense and sparse vectors using Milvus.
# You can optionally choose to use the BGE-M3 model to embed the text as dense
# and sparse vectors, or simply use random generated vectors as the example.

# To use BGE-M3 model, you need to install the optional `model` module in pymilvus:
# and sparse vectors, or simply use random generated vectors as an example.
# Note that the sparse vector search feature is only available in Milvus 2.4.0 or
# higher version. Make sure you follow https://milvus.io/docs/install_standalone-docker.md
# to set up the latest version of Milvus in your local environment.

# To connect to Milvus server, you need the python client library called pymilvus.
# To use BGE-M3 model, you need to install the optional `model` module in pymilvus.
# You can get them by simply running the following commands:
# pip install pymilvus
# pip install pymilvus[model]

# If true, use BGE-M3 model to generate dense and sparse vectors.
# If false, use random numbers to compose dense and sparse vectors.
use_bge_m3 = True

# The overall steps are as follows:
Expand Down Expand Up @@ -112,4 +121,4 @@ def random_embedding(texts):
# text: Artificial intelligence was founded as an academic discipline in 1956. distance 0.016129031777381897

# Drop the collection to clean up the data.
utility.drop_collection(col_name)
utility.drop_collection(col_name)