You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am cerently working on a work using faiss on gpu to sove a vector search project, there is a loop in my project and each loop contains an faiss search section, I'm looking for a way to accelerate this process but have a few questions.
Platform
Faiss version: 1.7.2
Running on:
CPU
[✔] GPU
Interface:
C++
[✔] Python
#Questions
my codes are: res = faiss.StandardGpuResources() config = faiss.GpuIndexIVFFlatConfig() config.use_raft = False index = faiss.GpuIndexIVFFlat(res, 64, 10,faiss.METRIC_INNER_PRODUCT,config) index.nprobe = 1 index.train(vecs) index.add(vecs) distances, indices = index.search(nq, 1000)
I find that "index = faiss.index_cpu_to_gpu(res, 2, index)" takes a lot of time to complete so I switch to " index = faiss.GpuIndexIVFFlat(res, 64, 10,faiss.METRIC_INNER_PRODUCT,config)", is there a difference?
Because initializing the index takes a lot of time in both circumstances, like I said there is a loop in my project and each loop contains an faiss search section, I want to initialize the index before going into the loop( so I can save the time for initializing ), thus i need to empty the index( reversing the add method )after each search( beacuse the vecs and nq are different in each loop ), I tried "index.remove_ids(np.arange(vecs.len))" but encounter: RuntimeError: Error in virtual size_t faiss::Index::remove_ids(const faiss::IDSelector&) at /home/conda/feedstock_root/build_artifacts/faiss-split_1644327811086/work/faiss/Index.cpp:43: remove_ids not implemented for this type of index
Is there a way to empty the index after searching in GPU ?
Will my idea actually work?
This discussion was converted from issue #3956 on October 16, 2024 17:22.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
I am cerently working on a work using faiss on gpu to sove a vector search project, there is a loop in my project and each loop contains an faiss search section, I'm looking for a way to accelerate this process but have a few questions.
Platform
Faiss version: 1.7.2
Running on:
Interface:
#Questions
my codes are:
res = faiss.StandardGpuResources()
config = faiss.GpuIndexIVFFlatConfig()
config.use_raft = False
index = faiss.GpuIndexIVFFlat(res, 64, 10,faiss.METRIC_INNER_PRODUCT,config)
index.nprobe = 1
index.train(vecs)
index.add(vecs)
distances, indices = index.search(nq, 1000)
I find that "index = faiss.index_cpu_to_gpu(res, 2, index)" takes a lot of time to complete so I switch to " index = faiss.GpuIndexIVFFlat(res, 64, 10,faiss.METRIC_INNER_PRODUCT,config)", is there a difference?
Because initializing the index takes a lot of time in both circumstances, like I said there is a loop in my project and each loop contains an faiss search section, I want to initialize the index before going into the loop( so I can save the time for initializing ), thus i need to empty the index( reversing the add method )after each search( beacuse the vecs and nq are different in each loop ), I tried "index.remove_ids(np.arange(vecs.len))" but encounter:
RuntimeError: Error in virtual size_t faiss::Index::remove_ids(const faiss::IDSelector&) at /home/conda/feedstock_root/build_artifacts/faiss-split_1644327811086/work/faiss/Index.cpp:43: remove_ids not implemented for this type of index
Is there a way to empty the index after searching in GPU ?
Will my idea actually work?
Beta Was this translation helpful? Give feedback.
All reactions