Skip to content

Commit 833ba2e

Browse files
kuarorafacebook-github-bot
authored andcommitted
Adding buck target for experiment bench_fw_ivf (#3423)
Summary: Adding small fixes to run experiments from fbcode. 1. Added buck target 2. Full import path of faiss bench_fw modules 3. new dataset path to run tests locally as we can't use an existing directory ./data in fbcode. Reviewed By: algoriddle Differential Revision: D57235092
1 parent 0876ada commit 833ba2e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

benchs/bench_fw_ivf.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
import logging
76
import argparse
7+
import logging
88
import os
99

10-
from bench_fw.benchmark import Benchmark
11-
from bench_fw.benchmark_io import BenchmarkIO
12-
from bench_fw.descriptors import DatasetDescriptor, IndexDescriptor
10+
from faiss.benchs.bench_fw.benchmark import Benchmark
11+
from faiss.benchs.bench_fw.benchmark_io import BenchmarkIO
12+
from faiss.benchs.bench_fw.descriptors import (
13+
DatasetDescriptor,
14+
IndexDescriptor,
15+
)
1316

1417
logging.basicConfig(level=logging.INFO)
1518

19+
1620
def sift1M(bio):
1721
benchmark = Benchmark(
1822
num_threads=32,
@@ -37,6 +41,7 @@ def sift1M(bio):
3741
benchmark.set_io(bio)
3842
benchmark.benchmark(result_file="result.json", local=False, train=True, reconstruct=False, knn=True, range=False)
3943

44+
4045
def bigann(bio):
4146
for scale in [1, 2, 5, 10, 20, 50]:
4247
benchmark = Benchmark(

contrib/datasets.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import os
77
import numpy as np
88
import faiss
9+
import getpass
10+
911

1012
from .vecs_io import fvecs_read, ivecs_read, bvecs_mmap, fvecs_mmap
1113
from .exhaustive_search import knn
@@ -115,10 +117,12 @@ def get_groundtruth(self, k=100):
115117
# that directory is
116118
############################################################################
117119

120+
username = getpass.getuser()
118121

119122
for dataset_basedir in (
120123
'/datasets01/simsearch/041218/',
121-
'/mnt/vol/gfsai-flash3-east/ai-group/datasets/simsearch/'):
124+
'/mnt/vol/gfsai-flash3-east/ai-group/datasets/simsearch/',
125+
f'/home/{username}/simsearch/data/'):
122126
if os.path.exists(dataset_basedir):
123127
break
124128
else:

0 commit comments

Comments
 (0)