Pārlūkot izejas kodu

Refactor:Improve the float compare for LocalAIRerank (#9428)

### What problem does this PR solve?
Improve the float compare for LocalAIRerank

### Type of change

- [x] Refactoring
tags/v0.20.2
Stephen Hu pirms 2 mēnešiem
vecāks
revīzija
da5cef0686
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1
    1
      rag/llm/rerank_model.py

+ 1
- 1
rag/llm/rerank_model.py Parādīt failu

@@ -268,7 +268,7 @@ class LocalAIRerank(Base):
max_rank = np.max(rank)

# Avoid division by zero if all ranks are identical
if max_rank - min_rank != 0:
if not np.isclose(min_rank, max_rank, atol=1e-3):
rank = (rank - min_rank) / (max_rank - min_rank)
else:
rank = np.zeros_like(rank)

Notiek ielāde…
Atcelt
Saglabāt