Faiss: Segmentation fault or process interrupted by signal 11: SIGSEGV. Python wrapper.

Created on 13 Feb 2018  路  3Comments  路  Source: facebookresearch/faiss

````
def create_faiss_index(vectors):
d = vectors.shape[1]
nlist = 1000
quantizer = faiss.IndexFlatL2(d)
indx = faiss.IndexIVFFlat(quantizer, d, nlist, faiss.METRIC_L2)
assert not indx.is_trained
indx.train(vectors)
assert indx.is_trained
indx.add(vectors)
return indx

def find_k_nearest(index, vectors, k=10, nprobe=10):
index.nprobe = nprobe
D, I = index.search(vectors, k)
return D, I
````

In the code index object is created in one function and is used in another. And it crushes with segmentation fault. BUT if I create and use index in the same function it works fine. R u going to fix it, guys?

Most helpful comment

All 3 comments

Not entirely sure, but I think that the quantizer is being dropped from the moment you return the index from that function. Have you tried returning both the index and the quantizer from create_faiss_index?

@Enet4 thank you very much! It works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danny1984 picture danny1984  路  3Comments

linghuang picture linghuang  路  3Comments

minjiaz picture minjiaz  路  3Comments

mylyu picture mylyu  路  3Comments

jukaradayi picture jukaradayi  路  3Comments