mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-10 14:54:24 +00:00
Fix: rerank issue. (#5696)
### What problem does this PR solve? #5673 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
48f3f49e80
commit
df9b7b2fe9
@ -15,6 +15,7 @@
|
|||||||
#
|
#
|
||||||
import re
|
import re
|
||||||
import threading
|
import threading
|
||||||
|
from collections.abc import Iterable
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -135,6 +136,8 @@ class DefaultRerank(Base):
|
|||||||
else:
|
else:
|
||||||
scores = self._model.compute_score(batch_pairs, max_length=max_length)
|
scores = self._model.compute_score(batch_pairs, max_length=max_length)
|
||||||
scores = sigmoid(np.array(scores)).tolist()
|
scores = sigmoid(np.array(scores)).tolist()
|
||||||
|
if not isinstance(scores, Iterable):
|
||||||
|
scores = [scores]
|
||||||
return scores
|
return scores
|
||||||
|
|
||||||
def similarity(self, query: str, texts: list):
|
def similarity(self, query: str, texts: list):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user