Skip to content

Chapter 8, page 232 #60

@ChiEaton

Description

@ChiEaton

I am running the code below on Colab. But getting the error in index that ValueError: input not a numpy array
Anyone helps? thanks.

import faiss

dim = embeds.shape[1]
index = faiss.IndexFlatL2(dim)
index.add(np.float32(embeds))


ValueError Traceback (most recent call last)
in <cell line: 0>()
3 dim = embeds.shape[1]
4 index = faiss.IndexFlatL2(dim)
----> 5 index.add(np.float32(embeds))

1 frames
/usr/local/lib/python3.11/dist-packages/faiss/swigfaiss_avx512.py in swig_ptr(a)
11448
11449 def swig_ptr(a):

11450 return _swigfaiss_avx512.swig_ptr(a)
11451
11452 def rev_swig_ptr(*args):

ValueError: input not a numpy array

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