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
This commit is contained in:
parent
9098efb8aa
commit
da5cef0686
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Reference in a new issue