Update README.md
Browse files
README.md
CHANGED
|
@@ -7,4 +7,29 @@ Part of **BEIR-PL: Zero Shot Information Retrieval Benchmark for the Polish Lang
|
|
| 7 |
|
| 8 |
Link to arxiv: https://arxiv.org/pdf/2305.19840.pdf
|
| 9 |
|
| 10 |
-
Contact: konrad.wojtasik@pwr.edu.pl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
Link to arxiv: https://arxiv.org/pdf/2305.19840.pdf
|
| 9 |
|
| 10 |
+
Contact: konrad.wojtasik@pwr.edu.pl
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
How to use:
|
| 14 |
+
|
| 15 |
+
With sentence transformers:
|
| 16 |
+
```
|
| 17 |
+
from sentence_transformers import CrossEncoder
|
| 18 |
+
model_path = "clarin-knext/herbert-base-reranker-msmarco"
|
| 19 |
+
model = CrossEncoder(model_path, max_length=512)
|
| 20 |
+
scores = model.predict([('Query', 'Paragraph1'), ('Query', 'Paragraph2') , ('Query', 'Paragraph3')])
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
With transformers:
|
| 24 |
+
```
|
| 25 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 26 |
+
import torch
|
| 27 |
+
model_path = "clarin-knext/herbert-base-reranker-msmarco"
|
| 28 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 30 |
+
features = tokenizer(['Jakie miasto jest stolica Polski?', 'Stolicą Polski jest Warszawa.'], padding=True, truncation=True, return_tensors="pt")
|
| 31 |
+
model.eval()
|
| 32 |
+
with torch.no_grad():
|
| 33 |
+
scores = model(**features).logits
|
| 34 |
+
print(scores)
|
| 35 |
+
```
|