After the training, we merged the original and fine-tuned weights to create the final checkpoint
We used a custom implementation of XLM-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"
. This is especially important for this model, since
BAAI/bge-reranker-v2-m3
supports long contexts of 8192 tokens. For such input length, the inference can be up to 400% faster with Flash Attention in comparison to the original model.
In most cases, the use of
sdadas/polish-reranker-roberta-v2
is preferred to this model as it achieves better results for Polish. The main advantage of this model is its context length, so it may perform better on some datasets with long documents.
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-bge-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=8192, 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
64.21
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-bge-v2 on huggingface.co
192
Total runs
-3
24-hour runs
-62
3-day runs
-56
7-day runs
-600
30-day runs
More Information About polish-reranker-bge-v2 huggingface.co Model
polish-reranker-bge-v2 huggingface.co is an AI model on huggingface.co that provides polish-reranker-bge-v2's model effect (), which can be used instantly with this sdadas polish-reranker-bge-v2 model. huggingface.co supports a free trial of the polish-reranker-bge-v2 model, and also provides paid use of the polish-reranker-bge-v2. Support call polish-reranker-bge-v2 model through api, including Node.js, Python, http.
polish-reranker-bge-v2 huggingface.co is an online trial and call api platform, which integrates polish-reranker-bge-v2's modeling effects, including api services, and provides a free online trial of polish-reranker-bge-v2, you can try polish-reranker-bge-v2 online for free by clicking the link below.
sdadas polish-reranker-bge-v2 online free url in huggingface.co:
polish-reranker-bge-v2 is an open source model from GitHub that offers a free installation service, and any user can find polish-reranker-bge-v2 on GitHub to install. At the same time, huggingface.co provides the effect of polish-reranker-bge-v2 install, users can directly use polish-reranker-bge-v2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
polish-reranker-bge-v2 install url in huggingface.co: