Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: create_direct_map for GPU indexes and allow reconstruct #2181

Open
2 of 4 tasks
urialon opened this issue Jan 7, 2022 · 1 comment
Open
2 of 4 tasks

Comments

@urialon
Copy link

urialon commented Jan 7, 2022

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)

@mdouze mdouze added the GPU label Jan 11, 2022
@mdouze
Copy link
Contributor

mdouze commented Jan 11, 2022

Right, GPU indexes do not support reconstruct.
Currently the best alternative is to keep a CPU copy of the index and reconstruct from that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants