From 4fcd05ad23f880e2c03bf407a11d46266ced118d Mon Sep 17 00:00:00 2001 From: GYH <43509927+guoyuhao2330@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:25:50 +0800 Subject: [PATCH] fix Rerank Vector Similarity Score (#1249) ### What problem does this PR solve? #1243 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/llm/rerank_model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.py index 7e6b73403..ba81273ce 100644 --- a/rag/llm/rerank_model.py +++ b/rag/llm/rerank_model.py @@ -71,6 +71,7 @@ class DefaultRerank(Base): res = [] for i in range(0, len(pairs), batch_size): scores = self._model.compute_score(pairs[i:i + batch_size], max_length=2048) + scores = sigmoid(np.array(scores)).tolist() if isinstance(scores, float): res.append(scores) else: res.extend(scores) return np.array(res), token_count