Skip to content

Commit

Permalink
fix Rerank Vector Similarity Score (#1249)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

#1243 
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
guoyuhao2330 authored Jun 24, 2024
1 parent f8fe415 commit 4fcd05a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rag/llm/rerank_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def similarity(self, query: str, texts: list):
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
Expand Down

0 comments on commit 4fcd05a

Please sign in to comment.