Commit
·
6f31aa4
1
Parent(s):
ee469c9
Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,42 @@
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
# Evalution Metrics
|
4 |
|
5 |
| Model | Mmarco Dev | | MrTyDi Test | | Miracal Test | |
|
6 |
|-----------------------------------------|------------|----------------|-------------|----------------|--------------|----------------------------|
|
|
|
1 |
+
# Indobert Cross-Encoder
|
2 |
|
3 |
+
This is a Cross-Encoder model for ID that can be used for passage re-ranking. It was trained on the multilingual version of [MS Marco Passage Ranking](https://github.com/microsoft/MSMARCO-Passage-Ranking) task.
|
4 |
+
|
5 |
+
The model can be used for Information Retrieval: See [SBERT.net Retrieve & Re-rank](https://www.sbert.net/examples/applications/retrieve_rerank/README.html).
|
6 |
+
|
7 |
+
## Usage with SentenceTransformers
|
8 |
+
|
9 |
+
When you have [SentenceTransformers](https://www.sbert.net/) installed, you can use the model like this:
|
10 |
+
```python
|
11 |
+
from sentence_transformers import CrossEncoder
|
12 |
+
model = CrossEncoder('model_name', max_length=512)
|
13 |
+
query = 'How many people live in Berlin?'
|
14 |
+
docs = ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.']
|
15 |
+
pairs = [(query, doc) for doc in docs]
|
16 |
+
scores = model.predict(pairs)
|
17 |
+
```
|
18 |
+
|
19 |
+
|
20 |
+
## Usage with Transformers
|
21 |
+
With the transformers library, you can use the model like this:
|
22 |
+
|
23 |
+
```python
|
24 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
25 |
+
import torch
|
26 |
+
|
27 |
+
model = AutoModelForSequenceClassification.from_pretrained('model_name')
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained('model_name')
|
29 |
+
|
30 |
+
features = tokenizer(['How many people live in Berlin?', 'How many people live in Berlin?'], ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'], padding=True, truncation=True, return_tensors="pt")
|
31 |
+
|
32 |
+
model.eval()
|
33 |
+
with torch.no_grad():
|
34 |
+
scores = model(**features).logits
|
35 |
+
print(scores)
|
36 |
+
```
|
37 |
+
|
38 |
+
## Performance
|
39 |
|
|
|
40 |
|
41 |
| Model | Mmarco Dev | | MrTyDi Test | | Miracal Test | |
|
42 |
|-----------------------------------------|------------|----------------|-------------|----------------|--------------|----------------------------|
|