Skip to content

Commit

Permalink
Small nits and formatting (facebookresearch#3907)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookresearch#3907

same as title.
Fix checking right desc

Reviewed By: satymish

Differential Revision: D63854967

fbshipit-source-id: b8bc48662bc38ac96cf9241bdbe2be2b23f1a37e
  • Loading branch information
kuarora authored and facebook-github-bot committed Oct 4, 2024
1 parent caa3b34 commit d2692b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion benchs/bench_fw/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,13 +874,14 @@ def create_gt_knn(self, knn_desc, search=True) -> Optional[KnnDescriptor]:
if self.search_op:
gt_knn_desc = self.search_op.get_flat_desc(knn_desc.flat_name())
if gt_knn_desc is None:
if knn_desc.index_desc is not None:
if knn_desc.gt_index_desc is not None:
gt_index_desc = knn_desc.gt_index_desc
else:
gt_index_desc = self.build_op.get_flat_desc(
knn_desc.index_desc.flat_name()
)
knn_desc.gt_index_desc = gt_index_desc

assert gt_index_desc is not None
gt_knn_desc = KnnDescriptor(
d=knn_desc.d,
Expand Down
11 changes: 5 additions & 6 deletions benchs/bench_fw/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,6 @@ def add_range_or_val(name, range):
if self.search_params and name in self.search_params
else range
),
[self.search_params[name]]
if self.search_params and name in self.search_params
else range,
)

add_range_or_val("snap", [0])
Expand Down Expand Up @@ -1023,9 +1020,11 @@ def get_quantizer(self, dry_run, pretransform=None):
d=model_ivf.quantizer.d,
metric=model_ivf.quantizer.metric_type,
database_vectors=centroids,
construction_params=self.construction_params[1:]
if self.construction_params is not None
else None,
construction_params=(
self.construction_params[1:]
if self.construction_params is not None
else None
),
search_params=None,
factory=reverse_index_factory(model_ivf.quantizer),
training_vectors=centroids,
Expand Down

0 comments on commit d2692b8

Please sign in to comment.