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 support Qdrant quantization mode config #470

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions ann_benchmarks/algorithms/qdrant/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG QDRANT_VERSION=1.3.0
ARG QDRANT_CLIENT_VERSION=1.3.1
ARG QDRANT_VERSION=1.5.1
ARG QDRANT_CLIENT_VERSION=1.5.4
FROM qdrant/qdrant:v${QDRANT_VERSION}

ARG QDRANT_CLIENT_VERSION
Expand Down
4 changes: 2 additions & 2 deletions ann_benchmarks/algorithms/qdrant/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ float:
run_groups:
default:
args: [
[True, False], #quantization
['none', 'scalar', 'binary'], #quantization
[ 8, 16, 24, 32, 40, 48, 64, 72 ], #m
[ 64, 128, 256, 512 ], #ef_construct
]
query_args: [
[null, 8, 16, 32, 64, 128, 256, 512, 768], #hnsw_ef
[True, False], # re-score
]
]
12 changes: 9 additions & 3 deletions ann_benchmarks/algorithms/qdrant/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
OptimizersConfigDiff,
ScalarQuantization,
ScalarQuantizationConfig,
BinaryQuantization,
BinaryQuantizationConfig,
ScalarType,
HnswConfigDiff,
)
Expand All @@ -29,7 +31,7 @@ def __init__(self, metric, quantization, m, ef_construct):
self._m = m
self._metric = metric
self._collection_name = "ann_benchmarks_test"
self._quantization = quantization
self._quantization_mode = quantization
self._grpc = True
self._search_params = {"hnsw_ef": None, "rescore": True}
self.batch_results = []
Expand All @@ -48,14 +50,18 @@ def fit(self, X):
X = X.astype(np.float32)

quantization_config = None
if self._quantization:
if self._quantization_mode == "scalar":
quantization_config = ScalarQuantization(
scalar=ScalarQuantizationConfig(
always_ram=True,
quantile=0.99,
type=ScalarType.INT8,
)
)
elif self._quantization_mode == "binary":
quantization_config = BinaryQuantization(
binary=BinaryQuantizationConfig(always_ram=True)
)

# Disabling indexing during bulk upload
# https://qdrant.tech/documentation/tutorials/bulk-upload/#disable-indexing-during-upload
Expand Down Expand Up @@ -188,4 +194,4 @@ def get_batch_results(self):

def __str__(self):
hnsw_ef = self._search_params["hnsw_ef"]
return f"Qdrant(quantization={self._quantization}, hnsw_ef={hnsw_ef})"
return f"Qdrant(quantization={self._quantization_mode}, hnsw_ef={hnsw_ef})"