Skip to content

LaminiIndex faiss type error  #116

@soy-caminante

Description

@soy-caminante

I think this strictly speaking it is not a bug, but I this it would be good to know this (and fix it if possible).

The object self.index in LaminiIndex is an instantation of faiss.IndexFlatL2. on the calls to self.index.add and self.index.search the argument must be a numpy.array of type "float32".

It has taken me a little while to discover it. My system by default creates the numpy.arrays as "float64" making the app crash with this exception:

File "/usr/local/lib/python3.10/dist-packages/faiss/init.py", line 322, in replacement_search
self.search_c(n, swig_ptr(x), k, swig_ptr(D), swig_ptr(I))
File "/usr/local/lib/python3.10/dist-packages/faiss/swigfaiss.py", line 2146, in search
return _swigfaiss.IndexFlat_search(self, n, x, k, distances, labels)
TypeError: in method 'IndexFlat_search', argument 3 of type 'float const *'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions