Faiss: How may I separate pretransform matrix and the main index

Created on 25 Mar 2019  路  3Comments  路  Source: facebookresearch/faiss

I have a trained index using "OPQ64_128,IVF16384_HNSW32,PQ64". It works great and now I want to separate the pretransform and index, so I can use the OPQ matrix for multi-thread data loading with less memory overhead. Possible to achieve this? I remember I saw related solution somewhere but cannot find it now. Thanks in advance.

question

Most helpful comment

For those who are interested. I got it working by

mat = faiss.downcast_VectorTransform(index.chain.at(0))
main_index = faiss.downcast_index(index.index)

for a index OPQ64_128,IVF16384_HNSW32,PQ64

All 3 comments

The IndexPreTransform wraps the underlying IVF index, which you can obtain simply by index_pre_transform.index, which you may need to downcast to IndexIVF. The OPQMatrix object will be in the index_pre_transform.chain, which is a vector of VectorTransform (see https://github.com/facebookresearch/faiss/blob/master/VectorTransform.h).

Thanks for the information.

For those who are interested. I got it working by

mat = faiss.downcast_VectorTransform(index.chain.at(0))
main_index = faiss.downcast_index(index.index)

for a index OPQ64_128,IVF16384_HNSW32,PQ64

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xxllp picture xxllp  路  3Comments

minjiaz picture minjiaz  路  3Comments

Tony-Hou picture Tony-Hou  路  3Comments

cherryPotter picture cherryPotter  路  3Comments

daniellevy picture daniellevy  路  3Comments