Преглед на файлове

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 преди 2 месеца
родител
ревизия
da5cef0686
No account linked to committer's email address
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1
    1
      rag/llm/rerank_model.py

+ 1
- 1
rag/llm/rerank_model.py Целия файл

@@ -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)

Loading…
Отказ
Запис