How to reconstruct() from an IVF index use add_with_ids
czpmango opened this issue · 1 comments
czpmango commented
I got the error DirectMap.cpp:82: direct map not initialized
when reconstruct()
from an IVF index.
import faiss
quantizer = faiss.IndexFlatL2(dim)
index = faiss.IndexIVFFlat(quantizer, dim, nb)
index.train(train_vectors)
index.add_with_ids(db_vectors, idx)
index.make_direct_map(False) # use nomap type
item0 = index.reconstruct(0)
print("Reconstructed item 0: ", item0)
Is there any solution for this scenario?
bshethmeta commented
Can you help me understand why setting make_direct_map to True will not work for your usecase?