Skip to content

Commit

Permalink
Adding buck target for experiment bench_fw_ivf (facebookresearch#3423)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookresearch#3423

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, junjieqi

Differential Revision: D57235092

fbshipit-source-id: f78a23199e619b640a19ca37f8b52ff0abdd8298
  • Loading branch information
kuarora authored and facebook-github-bot committed May 31, 2024
1 parent 0beecb4 commit 2230434
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions benchs/bench_fw_ivf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import logging
import argparse
import logging
import os

from bench_fw.benchmark import Benchmark
from bench_fw.benchmark_io import BenchmarkIO
from bench_fw.descriptors import DatasetDescriptor, IndexDescriptor
from faiss.benchs.bench_fw.benchmark import Benchmark
from faiss.benchs.bench_fw.benchmark_io import BenchmarkIO
from faiss.benchs.bench_fw.descriptors import (
DatasetDescriptor,
IndexDescriptor,
)

logging.basicConfig(level=logging.INFO)


def sift1M(bio):
benchmark = Benchmark(
num_threads=32,
Expand All @@ -37,6 +41,7 @@ def sift1M(bio):
benchmark.set_io(bio)
benchmark.benchmark(result_file="result.json", local=False, train=True, reconstruct=False, knn=True, range=False)


def bigann(bio):
for scale in [1, 2, 5, 10, 20, 50]:
benchmark = Benchmark(
Expand Down
6 changes: 5 additions & 1 deletion contrib/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import os
import numpy as np
import faiss
import getpass


from .vecs_io import fvecs_read, ivecs_read, bvecs_mmap, fvecs_mmap
from .exhaustive_search import knn
Expand Down Expand Up @@ -115,10 +117,12 @@ def get_groundtruth(self, k=100):
# that directory is
############################################################################

username = getpass.getuser()

for dataset_basedir in (
'/datasets01/simsearch/041218/',
'/mnt/vol/gfsai-flash3-east/ai-group/datasets/simsearch/'):
'/mnt/vol/gfsai-flash3-east/ai-group/datasets/simsearch/',
f'/home/{username}/simsearch/data/'):
if os.path.exists(dataset_basedir):
break
else:
Expand Down

0 comments on commit 2230434

Please sign in to comment.