Closed M1ha-Shvn closed 1 month ago
from flashrank import Ranker, RerankRequest
ranker = Ranker("ms-marco-MultiBERT-L-12", log_level="DEBUG")
passages = [
{"id": "1", "text": "Our library is closed at 3pm.", "meta": {}},
{"id": "2", "text": "You can buy books cheaply in our library book store.", "meta": {}},
{"id": "3", "text": "The library address is in Washington street, 7.", "meta": {}},
]
query = "Where is the library?"
request = RerankRequest(query=query, passages=passages)
results = ranker.rerank(request)
prints
{'id': '3', 'text': 'The library address is in Washington street, 7.', 'meta': {'additional': 'info3'}, 'score': 0.9984252}
{'id': '1', 'text': 'Our library is closed at 3pm.', 'meta': {'additional': 'info1'}, 'score': 0.0036173377}
{'id': '2', 'text': 'You can buy books cheaply in our library book store.', 'meta': {'additional': 'info2'}, 'score': 0.0020632916}
Upgrade to 0.2.5
Hi. flashrank version: 0.2.4 I'm trying to implement a reranker using
ms-marco-MultiBERT-L-12
model (language is not English in my case). I do the following:What I get is very unexpected:
score
field is not float, but a list of floats. What does it mean?It looks like this strange score should be sorted by its second number, in this case result would be relevant. Can you give me a clue, what I'm doing wrong?