mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-11 22:50:00 +00:00
Fix typos in tests and contrib directories (#4672)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4672 Fixed typos in test files and contrib utilities: tests/: - Fixed 20 typos across test files (C++ and Python) - Fixed function/class name typos in Python tests: * test_result_order_miltihash → test_result_order_multihash * TestOrthognalReconstruct → TestOrthogonalReconstruct * test_recons_orthogona_impossible → test_recons_orthogonal_impossible - Fixed comment typos and error messages in C++ tests contrib/: - Fixed 9 typos in Python contrib utilities - Fixed string literal typos in client_server.py and rpc.py - Fixed documentation typos in evaluation.py and big_batch_search.py All changes maintain backward compatibility - no API changes. Reviewed By: mnorris11 Differential Revision: D86571375 fbshipit-source-id: bd0edf7ca2e004f78e0ccba7f4aac7db6621781a
This commit is contained in:
committed by
meta-codesync[bot]
parent
3c54e2efb8
commit
3a43e35292
@@ -270,7 +270,7 @@ def big_batch_search(
|
||||
compute_threads>1: the knn function will get an additional thread_no that
|
||||
tells which worker should handle this.
|
||||
|
||||
In threaded mode, the computation is tiled with the bucket perparation and
|
||||
In threaded mode, the computation is tiled with the bucket preparation and
|
||||
the writeback of results (useful to maximize GPU utilization).
|
||||
|
||||
use_float16: convert all matrices to float16 (faster for GPU gemm)
|
||||
@@ -279,7 +279,7 @@ def big_batch_search(
|
||||
|
||||
checkpointing (only for threaded > 1):
|
||||
checkpoint: file where the checkpoints are stored
|
||||
checkpoint_freq: when to perform checkpoinging. Should be a multiple of threaded
|
||||
checkpoint_freq: when to perform checkpointing. Should be a multiple of threaded
|
||||
|
||||
start_list, end_list: process only a subset of invlists
|
||||
"""
|
||||
|
||||
@@ -35,7 +35,7 @@ class SearchServer(rpc.Server):
|
||||
|
||||
|
||||
def run_index_server(index: faiss.Index, port: int, v6: bool = False):
|
||||
""" serve requests for that index forerver """
|
||||
""" serve requests for that index forever """
|
||||
rpc.run_server(
|
||||
lambda s: SearchServer(s, index),
|
||||
port, v6=v6)
|
||||
|
||||
@@ -80,7 +80,7 @@ def range_PR(lims_ref, Iref, lims_new, Inew, mode="overall"):
|
||||
|
||||
|
||||
def counts_to_PR(ngt, nres, ninter, mode="overall"):
|
||||
""" computes a precision-recall for a ser of queries.
|
||||
""" computes a precision-recall for a set of queries.
|
||||
ngt = nb of GT results per query
|
||||
nres = nb of found results per query
|
||||
ninter = nb of correct results per query (smaller than nres of course)
|
||||
@@ -313,7 +313,7 @@ class OperatingPoints:
|
||||
raise NotImplemented
|
||||
|
||||
def do_nothing_key(self):
|
||||
""" parameters to say we do noting, takes 0 time and has 0 performance"""
|
||||
""" parameters to say we do nothing, takes 0 time and has 0 performance"""
|
||||
raise NotImplemented
|
||||
|
||||
def is_pareto_optimal(self, perf_new, t_new):
|
||||
|
||||
+2
-2
@@ -110,7 +110,7 @@ class Server:
|
||||
|
||||
|
||||
def log(self, s):
|
||||
self.logf.write("Sever log %s: %s\n" % (self.log_prefix, s))
|
||||
self.logf.write("Server log %s: %s\n" % (self.log_prefix, s))
|
||||
|
||||
def one_function(self):
|
||||
"""
|
||||
@@ -179,7 +179,7 @@ class Server:
|
||||
traceback.print_exc(50,sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
LOG.info("exit sever")
|
||||
LOG.info("exit server")
|
||||
|
||||
def exec_loop_cleanup(self):
|
||||
pass
|
||||
|
||||
@@ -26,7 +26,7 @@ class Quantizer:
|
||||
|
||||
def train(self, x):
|
||||
"""
|
||||
takes a n-by-d array and peforms training
|
||||
takes a n-by-d array and performs training
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import numpy as np
|
||||
import faiss
|
||||
|
||||
# reduce number of threads to avoid excessive nb of threads in opt
|
||||
# mode (recuces runtime from 100s to 4s!)
|
||||
# mode (reduces runtime from 100s to 4s!)
|
||||
faiss.omp_set_num_threads(4)
|
||||
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ class TestKnn(unittest.TestCase):
|
||||
def test_result_order_binhash(self):
|
||||
self.subtest_result_order(0)
|
||||
|
||||
def test_result_order_miltihash(self):
|
||||
def test_result_order_multihash(self):
|
||||
self.subtest_result_order(3)
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class TestMapLong2Long(unittest.TestCase):
|
||||
assert m.search(12343) == -1
|
||||
|
||||
|
||||
class TestOrthognalReconstruct(unittest.TestCase):
|
||||
class TestOrthogonalReconstruct(unittest.TestCase):
|
||||
|
||||
def test_recons_orthonormal(self):
|
||||
lt = faiss.LinearTransform(20, 10, True)
|
||||
@@ -103,7 +103,7 @@ class TestOrthognalReconstruct(unittest.TestCase):
|
||||
|
||||
self.assertGreater(1e-5, err)
|
||||
|
||||
def test_recons_orthogona_impossible(self):
|
||||
def test_recons_orthogonal_impossible(self):
|
||||
lt = faiss.LinearTransform(20, 10, True)
|
||||
rs = np.random.RandomState(10)
|
||||
A = rs.randn(10 * 20).astype('float32')
|
||||
|
||||
@@ -36,7 +36,7 @@ std::vector<float> get_random_vectors(size_t n, int seed) {
|
||||
return x;
|
||||
}
|
||||
|
||||
/** InvetedLists implementation that dispatches the search to an InvertedList
|
||||
/** InvertedLists implementation that dispatches the search to an InvertedList
|
||||
* object that is passed in at query time */
|
||||
|
||||
struct DispatchingInvertedLists : faiss::ReadOnlyInvertedLists {
|
||||
@@ -142,7 +142,7 @@ TEST(COMMON, test_common_trained_index) {
|
||||
new_I[i] = I;
|
||||
}
|
||||
|
||||
// compare with reference reslt
|
||||
// compare with reference result
|
||||
for (int i = 0; i < N; i++) {
|
||||
ASSERT_EQ(ref_I[i], new_I[i]);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ TEST(TestFvecL1, manhattan_distance) {
|
||||
auto distance = faiss::fvec_L1(x.data(), y.data(), x.size());
|
||||
|
||||
ASSERT_EQ(distance, true_distance)
|
||||
<< "Mismatching fvec_Linf results for nrows = " << nrows;
|
||||
<< "Mismatching fvec_L1 results for nrows = " << nrows;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ class TestIVFImplem12(unittest.TestCase):
|
||||
def test_by_residual_odd_dim(self):
|
||||
self.do_test(True, d=30)
|
||||
|
||||
# testin single query
|
||||
# testing single query
|
||||
def test_no_residual_single_query(self):
|
||||
self.do_test(False, nq=1)
|
||||
|
||||
@@ -594,11 +594,11 @@ class TestReconstruct(unittest.TestCase):
|
||||
def test_by_residual(self):
|
||||
self.do_test(by_residual=True)
|
||||
|
||||
def do_test_generic(self, factory_string,
|
||||
by_residual=False, metric=faiss.METRIC_L2):
|
||||
def do_test_generic(self, factory_string,
|
||||
by_residual=False, metric=faiss.METRIC_L2):
|
||||
d = 32
|
||||
ds = datasets.SyntheticDataset(d, 250, 200, 10)
|
||||
index = faiss.index_factory(ds.d, factory_string, metric)
|
||||
index = faiss.index_factory(ds.d, factory_string, metric)
|
||||
if "IVF" in factory_string:
|
||||
index.by_residual = by_residual
|
||||
index.make_direct_map(True)
|
||||
@@ -618,7 +618,7 @@ class TestReconstruct(unittest.TestCase):
|
||||
index2 = faiss.deserialize_index(faiss.serialize_index(index))
|
||||
codes2 = index2.sa_encode(ds.get_database()[120:130])
|
||||
np.testing.assert_array_equal(codes, codes2)
|
||||
|
||||
|
||||
|
||||
def test_ivfpq_residual(self):
|
||||
self.do_test_generic("IVF20,PQ16x4fs", by_residual=True)
|
||||
|
||||
@@ -52,13 +52,13 @@ class TestHNSW(unittest.TestCase):
|
||||
lims, D, I = index.range_search(self.xq, radius)
|
||||
|
||||
nmiss = 0
|
||||
# check if returned resutls are a subset of the reference results
|
||||
# check if returned results are a subset of the reference results
|
||||
for i in range(len(self.xq)):
|
||||
ref = Iref[lims_ref[i]: lims_ref[i + 1]]
|
||||
new = I[lims[i]: lims[i + 1]]
|
||||
self.assertLessEqual(set(new), set(ref))
|
||||
nmiss += len(ref) - len(new)
|
||||
# currenly we miss 405 / 6019 neighbors
|
||||
# currently we miss 405 / 6019 neighbors
|
||||
self.assertLessEqual(nmiss, lims_ref[-1] * 0.1)
|
||||
|
||||
def test_hnsw_unbounded_queue(self):
|
||||
|
||||
@@ -192,7 +192,7 @@ TEST(IVF, list_context) {
|
||||
}
|
||||
std::vector<faiss::idx_t> coarse_idx(nb);
|
||||
index.quantizer->assign(nb, database.data(), coarse_idx.data());
|
||||
// pass dummy ids, the acutal ids are assigned in TextContext object
|
||||
// pass dummy ids, the actual ids are assigned in TextContext object
|
||||
std::vector<faiss::idx_t> xids(nb, 42);
|
||||
index.add_core(
|
||||
nb, database.data(), xids.data(), coarse_idx.data(), &context);
|
||||
|
||||
@@ -28,7 +28,7 @@ TEST(IVFPQ, accuracy) {
|
||||
// make the index object and train it
|
||||
faiss::IndexFlatL2 coarse_quantizer(d);
|
||||
|
||||
// a reasonable number of cetroids to index nb vectors
|
||||
// a reasonable number of centroids to index nb vectors
|
||||
int ncentroids = 25;
|
||||
|
||||
faiss::IndexIVFPQ index(&coarse_quantizer, d, ncentroids, 16, 8);
|
||||
|
||||
@@ -318,7 +318,7 @@ class TestComponents(unittest.TestCase):
|
||||
n,
|
||||
1)
|
||||
|
||||
# do icm encoding without pre-computed unary and bianry terms in Python
|
||||
# do icm encoding without pre-computed unary and binary terms in Python
|
||||
codebooks = faiss.vector_float_to_array(lsq.codebooks)
|
||||
codebooks = codebooks.reshape(M, K, d).copy()
|
||||
ref_codes = icm_encode_ref(x, codebooks, codes)
|
||||
|
||||
@@ -156,7 +156,7 @@ TEST(ONDISK, test_add) {
|
||||
}
|
||||
}
|
||||
|
||||
// WARN this thest will run multithreaded only in opt mode
|
||||
// WARN this test will run multithreaded only in opt mode
|
||||
TEST(ONDISK, make_invlists_threaded) {
|
||||
int nlist = 100;
|
||||
int code_size = 32;
|
||||
|
||||
@@ -974,7 +974,7 @@ def precomp_codebooks(codebooks):
|
||||
|
||||
|
||||
############################################################
|
||||
# Reference imelementation of table-based beam search (use_beam_LUT=1)
|
||||
# Reference implementation of table-based beam search (use_beam_LUT=1)
|
||||
############################################################
|
||||
|
||||
def beam_search_encode_step_tab(codes, L, distances, codebook_cross_prods_i,
|
||||
|
||||
@@ -379,7 +379,7 @@ class TestSearchParams(unittest.TestCase):
|
||||
|
||||
Dnew, Inew = index.search(ds.get_queries(), 10, params=params)
|
||||
|
||||
# make sure rhe parameter does indeed change the result...
|
||||
# make sure the parameter does indeed change the result...
|
||||
self.assertFalse(np.all(Inew == I0))
|
||||
|
||||
for param_name, value in ps_params.items():
|
||||
|
||||
Reference in New Issue
Block a user