浏览代码

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)
tags/v0.20.0
Stephen Hu 3 个月前
父节点
当前提交
95b9208b13
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      rag/llm/rerank_model.py

+ 1
- 1
rag/llm/rerank_model.py 查看文件

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)

正在加载...
取消
保存