faiss
faiss copied to clipboard
How to realize the reproducibility of IndexHNSWFlat
Summary
#1073 #983
I saw these two issues. But my issue still exists...
Platform
Ubuntu20.04 python3.10 faiss-cpu1.7.2
Running on:
- [x] CPU
- [ ] GPU
Interface:
- [ ] C++
- [x] Python
Reproduction instructions
import numpy as np
import faiss
np.random.seed(1234)
embeddings1 = np.load("e1.npy")
embeddings2 = np.load("e2.npy")
index = faiss.IndexHNSWFlat(384, 64, faiss.METRIC_INNER_PRODUCT)
index.add(embeddings2)
D1, I1 = index.search(embeddings1, 3)
for i, d in zip(I1, D1):
print(i, d)
When I run the code many times, I get many different results.