mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
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:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user