Commit c6a53c07 authored by Minjoon Seo's avatar Minjoon Seo Committed by Matthijs Douze

Bug fix: data needed to be added with ids (#723)

When data is being added to each index block, it needs to explicitly identify ids.
parent 4e8d3249
......@@ -51,7 +51,7 @@ if 1 <= stage <= 4:
i0, i1 = int(bno * xb.shape[0] / 4), int((bno + 1) * xb.shape[0] / 4)
index = faiss.read_index(tmpdir + "trained.index")
print("adding vectors %d:%d" % (i0, i1))
index.add(xb[i0:i1])
index.add_with_ids(xb[i0:i1], np.arange(i0, i1))
print("write " + tmpdir + "block_%d.index" % bno)
faiss.write_index(index, tmpdir + "block_%d.index" % bno)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment