Feature request: create_direct_map for GPU indexes and allow reconstruct
urialon opened this issue · 1 comments
Summary
Would it be possible to make_direct_map()
on GPU indexes, to allow calling index.reconstruct
?
If not, is there another way to reconstruct quickly using the GPU?
Thanks!
Platform
OS: Ubuntu
Faiss version: 1.7.1
Installed from: pip install faiss-gpu
Running on:
- CPU
- GPU
Interface:
- C++
- Python
Reproduction instructions
Load any index, convert it to GPU:
import faiss
indexfile = 'my_knn.index'
cpu_index = faiss.read_index(indexfile, faiss.IO_FLAG_ONDISK_SAME_DIR)
co = faiss.GpuClonerOptions()
co.useFloat16 = True
gpu_index = faiss.index_cpu_to_gpu(faiss.StandardGpuResources(), 0, cpu_index, co)
Now, it would be great if I could run:
gpu_index.make_direct_map()
(which currently results in: AttributeError: 'GpuIndexIVFPQ' object has no attribute 'make_direct_map'
)
and then ideally I would like to run:
gpu_index.reconstruct(5)
gpu_index.reconstruct(8)
gpu_index.reconstruct(7)
...
(which currently results in: faiss/faiss/Index.cpp:48: reconstruct not implemented for this type of index
)
Right, GPU indexes do not support reconstruct.
Currently the best alternative is to keep a CPU copy of the index and reconstruct from that.