fix: correct rerank_model condition logic (#10174)

### What problem does this PR solve?

fix the rerank_model condition logic by correcting the np.isclose check.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
buua436
2025-09-19 16:02:10 +08:00
committed by GitHub
parent 4846589599
commit 6c24ad7966

View File

@ -365,7 +365,7 @@ class OpenAI_APIRerank(Base):
max_rank = np.max(rank) max_rank = np.max(rank)
# Avoid division by zero if all ranks are identical # Avoid division by zero if all ranks are identical
if np.isclose(min_rank, max_rank, atol=1e-3): if not np.isclose(min_rank, max_rank, atol=1e-3):
rank = (rank - min_rank) / (max_rank - min_rank) rank = (rank - min_rank) / (max_rank - min_rank)
else: else:
rank = np.zeros_like(rank) rank = np.zeros_like(rank)