Explorar el Código

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 hace 2 meses
padre
commit
da5cef0686
No account linked to committer's email address
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1
    1
      rag/llm/rerank_model.py

+ 1
- 1
rag/llm/rerank_model.py Ver fichero

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

Cargando…
Cancelar
Guardar