faiss icon indicating copy to clipboard operation
faiss copied to clipboard

How to realize the reproducibility of IndexHNSWFlat

Open Zeng1998 opened this issue 3 years ago • 0 comments

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.

Zeng1998 avatar Oct 25 '22 13:10 Zeng1998