reading index from disk and removing specified ids #3665
Unanswered
ablattmann
asked this question in
Q&A
Replies: 1 comment
|
Have you tried doing this on a non-OnDisk index? What comes to mind is that the index just not contains the specified ids. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
I am given an index which was saved using merge_ondisk along with some metadata holding information over each vector stored in the index. Based on this metadata file, I want to remove vectors with specific ids from the index before using it for nearest neighbor search.
According to these instructions I can remove vectors from the index by using the corresponding ids for certain types of indexes. However, when loading the index with
faiss.read_index(indexfile.populated, faiss.IO_FLAG_ONDISK_SAME_DIR), the result is of typeindexPreTransform, which leaves me a bit puzzled. Nevertheless, I can call theindex.remove_ids()function with different subclasses ofIDSelector. But this will always return 0, i.e. not remove any vectors from the index. When explicitly extracting the ivf index withfaiss.extract_index_ivf(index)and setting directmap to e.g.DirectMap.Hashtableviaindex_ivf.direct_map.set_type(faiss.DirectMap.Hashtable), this behavior will not change.Is my aim of loading the index, removing entries corresponding to certain ids in a list of vector from which the index was created and doing a nearest neighbor search with the remaining subindex possbible at all? If yes, what am I missing? If no, are there any workarounds for this? Many thanks in advance!!
Faiss version: 1.7.2
Installed from: pip
Running on:
Interface:
Reproduction instructions
All reactions