mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 12:32:30 +08:00
Fix:Improve float operation when rerank (#8963)
### What problem does this PR solve? https://github.com/infiniflow/ragflow/issues/8915 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -358,7 +358,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 max_rank - min_rank != 0:
|
if 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user