We used a custom implementation of the RoBERTa with support for Flash Attention 2. If you want to use these features, load the model with the arguments
trust_remote_code=True
and
attn_implementation="flash_attention_2"
.
Our reranker achieves results close to
BAAI/bge-reranker-v2.5-gemma2-lightweight
on the PIRB benchmark, even outperforming it on some datasets. At the same time, it is over 21 times smaller — 435M vs. 9.24B parameters.
Usage (Huggingface Transformers)
The model can be used with Huggingface Transformers in the following way:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import numpy as np
query = "Jak dożyć 100 lat?"
answers = [
"Trzeba zdrowo się odżywiać i uprawiać sport.",
"Trzeba pić alkohol, imprezować i jeździć szybkimi autami.",
"Gdy trwała kampania politycy zapewniali, że rozprawią się z zakazem niedzielnego handlu."
]
model_name = "sdadas/polish-reranker-roberta-v2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(
model_name,
trust_remote_code=True,
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
device_map="cuda"
)
texts = [f"{query}</s></s>{answer}"for answer in answers]
tokens = tokenizer(texts, padding="longest", max_length=512, truncation=True, return_tensors="pt").to("cuda")
output = model(**tokens)
results = output.logits.detach().cpu().float().numpy()
results = np.squeeze(results)
print(results.tolist())
Evaluation Results
The model achieves
NDCG@10
of
65.30
in the Rerankers category of the Polish Information Retrieval Benchmark. See
PIRB Leaderboard
for detailed results.
Citation
@article{dadas2024assessing,
title={Assessing generalization capability of text ranking models in Polish},
author={Sławomir Dadas and Małgorzata Grębowiec},
year={2024},
eprint={2402.14318},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Runs of sdadas polish-reranker-roberta-v2 on huggingface.co
2.6K
Total runs
0
24-hour runs
0
3-day runs
6
7-day runs
392
30-day runs
More Information About polish-reranker-roberta-v2 huggingface.co Model
More polish-reranker-roberta-v2 license Visit here:
polish-reranker-roberta-v2 huggingface.co is an AI model on huggingface.co that provides polish-reranker-roberta-v2's model effect (), which can be used instantly with this sdadas polish-reranker-roberta-v2 model. huggingface.co supports a free trial of the polish-reranker-roberta-v2 model, and also provides paid use of the polish-reranker-roberta-v2. Support call polish-reranker-roberta-v2 model through api, including Node.js, Python, http.
polish-reranker-roberta-v2 huggingface.co is an online trial and call api platform, which integrates polish-reranker-roberta-v2's modeling effects, including api services, and provides a free online trial of polish-reranker-roberta-v2, you can try polish-reranker-roberta-v2 online for free by clicking the link below.
sdadas polish-reranker-roberta-v2 online free url in huggingface.co:
polish-reranker-roberta-v2 is an open source model from GitHub that offers a free installation service, and any user can find polish-reranker-roberta-v2 on GitHub to install. At the same time, huggingface.co provides the effect of polish-reranker-roberta-v2 install, users can directly use polish-reranker-roberta-v2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
polish-reranker-roberta-v2 install url in huggingface.co: