Skip to content

Commit a8d26cd

Browse files
Add --ef-runtime option to filter search experiments by ef values
1 parent 075c5c0 commit a8d26cd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

engine/base_client/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def run_experiment(
9191
upload_start_idx: int = 0,
9292
upload_end_idx: int = -1,
9393
num_queries: int = -1,
94+
ef_runtime: List[int] = [],
9495
):
9596
execution_params = self.configurator.execution_params(
9697
distance=dataset.config.distance, vector_size=dataset.config.vector_size
@@ -152,10 +153,18 @@ def run_experiment(
152153
if "search_params" in search_params:
153154
ef = search_params["search_params"].get("ef", "default")
154155
client_count = search_params.get("parallel", 1)
156+
157+
# Filter by client count if parallels is specified
155158
filter_client_count = len(parallels) > 0
156159
if filter_client_count and (client_count not in parallels):
157160
print(f"\tSkipping ef runtime: {ef}; #clients {client_count}")
158161
continue
162+
163+
# Filter by ef runtime if ef_runtime is specified
164+
filter_ef_runtime = len(ef_runtime) > 0
165+
if filter_ef_runtime and isinstance(ef, int) and (ef not in ef_runtime):
166+
print(f"\tSkipping ef runtime: {ef}; #clients {client_count} (not in ef_runtime filter)")
167+
continue
159168
for repetition in range(1, REPETITIONS + 1):
160169
print(
161170
f"\tRunning repetition {repetition} ef runtime: {ef}; #clients {client_count}"

run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def run(
2727
upload_start_idx: int = 0,
2828
upload_end_idx: int = -1,
2929
queries: int = typer.Option(-1, help="Number of queries to run. If the available queries are fewer, they will be reused."),
30+
ef_runtime: List[int] = typer.Option([], help="Filter search experiments by ef runtime values. Only experiments with these ef values will be run."),
3031
):
3132
"""
3233
Example:
@@ -70,6 +71,7 @@ def run(
7071
upload_start_idx,
7172
upload_end_idx,
7273
queries,
74+
ef_runtime,
7375
)
7476
client.delete_client()
7577

0 commit comments

Comments
 (0)