facebookresearch / faiss

A library for efficient similarity search and clustering of dense vectors.
https://faiss.ai
MIT License
31.27k stars 3.63k forks source link

Use MultiIndexQuantizer in IVFPQ index faild #3229

Open DoItWithMe opened 9 months ago

DoItWithMe commented 9 months ago

Summary

Using MultiIndexQuantizer fails in IVFPQ.

The example code I learn is: https://github.com/facebookresearch/faiss/blob/v1.7.4/tests/test_index.py#L171

Platform

OS:

Faiss version: faiss-cpu=1.7.4

Installed from: anaconda, pytorch,

Faiss compilation options:

Running on:

Interface:

Reproduction instructions

My code: image

My log: Traceback (most recent call last): File "/data/fabiss/video-dna-faiss/src/./main.py", line 739, in main() File "/data/fabiss/video-dna-faiss/src/./main.py", line 734, in main test_fabiss() File "/data/fabiss/video-dna-faiss/src/./main.py", line 459, in test_fabiss build_IndexIVFPQ_faiss_with_MultiIndexQuantizer( File "/data/fabiss/video-dna-faiss/src/./main.py", line 234, in build_IndexIVFPQ_faiss_with_MultiIndexQuantizer faiss_index = faiss.IndexIVFPQ( File "/root/miniconda3/envs/python310-faiss/lib/python3.10/site-packages/faiss/init.py", line 93, in replacement_init original_init(self, args) File "/root/miniconda3/envs/python310-faiss/lib/python3.10/site-packages/faiss/swigfaiss_avx2.py", line 7455, in init _swigfaiss_avx2.IndexIVFPQ_swiginit(self, _swigfaiss_avx2.new_IndexIVFPQ(args)) TypeError: Wrong number or type of arguments for overloaded function 'new_IndexIVFPQ'. Possible C/C++ prototypes are: faiss::IndexIVFPQ::IndexIVFPQ(faiss::Index ,size_t,size_t,size_t,size_t,faiss::MetricType) faiss::IndexIVFPQ::IndexIVFPQ(faiss::Index ,size_t,size_t,size_t,size_t) faiss::IndexIVFPQ::IndexIVFPQ()

mdouze commented 9 months ago

could you double check that all 4 int arguments are indeed ints?

DoItWithMe commented 9 months ago

It's same error even I cast the 4 arguments to int. image

could you double check that all 4 int arguments are indeed ints?