qdrant / qdrant/fastembed

[Bug]: Faiss Search Error with TextEmbedding

Open
#308 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.2k
Forks
248
Avg merge
4d 8h
Merged PRs (30d)
4

Description

What happened?

I'm encountering a ValueError when attempting to perform similarity search with Faiss using embeddings generated by FastEmbed's TextEmbedding.embed method.

What Python version are you on? e.g. python --version

Python - 3.10.12
fastembed - 0.3.4
faiss - 1.8.0

Version

0.2.7 (Latest)

What os are you seeing the problem on?

Linux

Relevant stack traces and/or logs
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-40-6bb0fc687deb> in <cell line: 2>()
      1 import numpy
----> 2 index.search(a,1)

/usr/local/lib/python3.10/dist-packages/faiss/class_wrappers.py in replacement_search(self, x, k, params, D, I)
    325         """
    326 
--> 327         n, d = x.shape
    328         x = np.ascontiguousarray(x, dtype='float32')
    329         assert d == self.d

ValueError: not enough values to unpack (expected 2, got 1)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with Python 3.10.12, fastembed 0.3.4, and faiss 1.8.0, starting at TextEmbedding.embed and the Faiss index.search call. Inspect the embedding shape where Faiss reaches faiss/class_wrappers.py:327; the issue is done when the reported ValueError no longer occurs for the documented search input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.