pymilvus icon indicating copy to clipboard operation
pymilvus copied to clipboard

[Bug]: TypeError: 'numpy.float64' object is not iterable

Open juhonkang opened this issue 7 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

When I use reranker with BGE reranker with the latest version, I got this

     41     query_document_pairs = [[query, text] for text in batched_text]
     42     batch_score = self.reranker.compute_score(
     43         query_document_pairs, normalize=self.normalize
     44     )
---> 45     scores.extend(batch_score)
     46 ranked_order = sorted(range(len(scores)), key=lambda i: scores[i], reverse=True)
     48 if top_k:

TypeError: 'numpy.float64' object is not iterable

Expected Behavior

Run without exception

Steps/Code To Reproduce behavior

Find a case that return len with 1
FlagEmbedding/flag_reranker.py

Environment details

- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0):
- Milvus configuration (Settings you made in `server_config.yaml`):

Anything else?

I have found the way to solve the problem, just want to share it with the developer community. In the FlagEmbedding/flag_reranker.py image Should comment out like this, because the extend method above cannot resolve with np.float64 datatype of an element of a list.

juhonkang avatar Jul 09 '24 04:07 juhonkang