faiss icon indicating copy to clipboard operation
faiss copied to clipboard

faiss reconstruct fails when RQ is used as the quantizer

Open ecozan opened this issue 3 years ago • 1 comments

Summary

faiss reconstruct fails when RQ is used as the quantizer with the error:

File ~/miniforge3/envs/dev/lib/python3.8/site-packages/faiss/swigfaiss.py:4717, in IndexIVF.reconstruct(self, key, recons)
   4715 def reconstruct(self, key, recons):
   4716     r""" reconstruct a vector. Works only if maintain_direct_map is set to 1 or 2"""
-> 4717     return _swigfaiss.IndexIVF_reconstruct(self, key, recons)

RuntimeError: Error in virtual void faiss::IndexIVF::reconstruct_from_offset(int64_t, int64_t, float *) const at /Users/runner/work/faiss-wheels/faiss-wheels/faiss/faiss/IndexIVF.cpp:919: reconstruct_from_offset not implemented

OS: macOS 12.5

Faiss version: 1.7.2

Installed from: anaconda

Running on:

  • [X] CPU
  • [ ] GPU

Interface:

  • [ ] C++
  • [X] Python

Reproduction instructions

Reconstruct works fine with:

index = faiss.index_factory(10, 'IVF5,PQ2x4')
index.train(faiss.randn((1000, 10), 123))
index.add(faiss.randn((1000, 10), 345))
index.make_direct_map()
index.reconstruct(5)

But throws the runtime error mentioned above when PQ is replaced by RQ

index = faiss.index_factory(10, 'IVF5,RQ2x4')
index.train(faiss.randn((1000, 10), 123))
index.add(faiss.randn((1000, 10), 345))
index.make_direct_map()
index.reconstruct(5)

ecozan avatar Aug 24 '22 07:08 ecozan

Sorry it slipped my mind. This should be easy to fix.

mdouze avatar Sep 28 '22 13:09 mdouze