Get error "Aborted (core dumped)" when deleting an ID from IVF + PQ with an IndexIDMap2 wrapper #4641
Replies: 1 comment
-
|
Since IndexIVFFlat and IndexIVFPQ already have add_with_ids() and remove_ids, there is no need to wrap with IndexIDMap2. |
Beta Was this translation helpful? Give feedback.
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.
-
Hello,
In C++17, with faiss 1.11.0, environment Raspberry Pi4, I have the following schema:
Config:
"dimension": 768,
"metric": INNER_PRODUCT,
"ivf": {
"nlist": 2048,
"nprobe": 32
},
"pq": {
"m": 96,
"nbits": 8
},
Source code:
a. Create Index
auto quantizer = std::make_unique<faiss::IndexFlat>(config.dimension, metric);
auto ivf_index =
std::make_unique<faiss::IndexIVFPQ>(quantizer.release(), config.dimension, ncentroids, m, nbits, metric);
ivf_index->nprobe = nprobe;
auto idmap_index = std::make_unique<faiss::IndexIDMap2>(ivf_index.release());
b. Add_with_ids
std::vector<float> processed_vector = embedding;
if (config.metric == MetricType::COSINE) {
processed_vector = NormalizeVector(embedding);
}
index->add_with_ids(1, processed_vector.data(), &custom_id);
c. Remove_ids
Input parameter: const std::vector<int64_t>& faiss_ids
// Create ID selector for the IDs to remove
faiss::IDSelectorBatch selector(faiss_ids.size(), faiss_ids.data());
// Remove vectors using remove_ids
size_t removed = index->remove_ids(selector);
Step to reprocedure
Step 1: I add a data set including 10 vectors, now the ID will be ID[1...10]
Step 2: I delete ID 1, the program says delete successful.
Step 3: I delete ID 2, the program will crash immediately.
Error log:
Faiss assertion 'j == index->ntotal' failed in virtual size_t faiss::IndexIDMapTemplatefaiss::Index::remove_ids(const IDSelector &) [IndexT = faiss::Index] at /usr/src/debug/faiss/1.11.0/faiss/IndexIDMap.cpp:197
Aborted (core dumped)
I found the same error message, but the cause is different, can not apply the fix in the article.
#4535
You can see the pictures to visualize what I mean better. I am new to this field so the terminology used may not be accurate.
Beta Was this translation helpful? Give feedback.
All reactions