Kaynağa Gözat

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 ay önce
ebeveyn
işleme
da5cef0686
No account linked to committer's email address
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1
    1
      rag/llm/rerank_model.py

+ 1
- 1
rag/llm/rerank_model.py Dosyayı Görüntüle

@@ -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…
İptal
Kaydet