SearchParametersIVF does not seem to work with IndexHNSWFlat #3600
eigenvectorBazuz
started this conversation in
General
Replies: 1 comment
-
|
As the name indicates, you should use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use IndexHNSWFlat to search a small dataset (1024 entries) of dimension 64 and it works fine. But when I try to use the SearchParametersIVF option to restrict some of the searches I get the following error:
`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/tmp/ipykernel_3079933/2324586828.py in
----> 1 M_b1 = calc_faiss_mask_causal_blocks(query_data, key_data, k=65, blocks=1, mode='graph')
2 evaluate_mask(query_data, key_data, M_b1, k=65)
3 # print(np.sum(Mf, axis=1))
4 # print(Mf[0,:])
~/cs-gpt/notebooks/lsh_aux.py in calc_faiss_mask_causal_blocks(Q, K, k, blocks, mode)
378 D, I = index.search(Q[query_block_range,:], k=k-1, params=faiss.SearchParametersIVF(sel=id_selector, nprobe=3))
379 elif mode == 'graph':
--> 380 D, I = index.search(Q[query_block_range,:], k=k-1, params=faiss.SearchParametersIVF(sel=id_selector))
381
382 # print(I)
~/.local/lib/python3.9/site-packages/faiss/class_wrappers.py in replacement_search(self, x, k, params, D, I)
341 assert I.shape == (n, k)
342
--> 343 self.search_c(n, swig_ptr(x), k, swig_ptr(D), swig_ptr(I), params)
344 return D, I
345
~/.local/lib/python3.9/site-packages/faiss/swigfaiss_avx2.py in search(self, n, x, k, distances, labels, params)
6424 def search(self, n, x, k, distances, labels, params=None):
6425 r""" entry point for search"""
-> 6426 return _swigfaiss_avx2.IndexHNSW_search(self, n, x, k, distances, labels, params)
6427
6428 def reconstruct(self, key, recons):
RuntimeError: Error in virtual void faiss::IndexHNSW::search(faiss::idx_t, const float*, faiss::idx_t, float*, faiss::idx_t*, const faiss::SearchParameters*) const at /project/faiss/faiss/IndexHNSW.cpp:297: Error: 'params' failed: params type invalid`
Beta Was this translation helpful? Give feedback.
All reactions