CoolFace
Modelpublic

carles-undergrad-thesis/indobert-crossencoder-mmarco

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes15downloads
Model Card

Indobert Cross-Encoder

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 task.

The model can be used for Information Retrieval: See SBERT.net Retrieve & Re-rank.

Usage with SentenceTransformers

When you have SentenceTransformers installed, you can use the model like this:

python
from sentence_transformers import CrossEncoder
model = CrossEncoder('model_name', max_length=512)
query = 'How many people live in Berlin?'
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.']
pairs = [(query, doc) for doc in docs]
scores = model.predict(pairs)

Usage with Transformers

With the transformers library, you can use the model like this:

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model = AutoModelForSequenceClassification.from_pretrained('model_name')
tokenizer = AutoTokenizer.from_pretrained('model_name')

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")

model.eval()
with torch.no_grad():
    scores = model(**features).logits
    print(scores)

Performance

ModelMmarco DevMrTyDi TestMiracal Test
MRR@10R@1000MRR@10R@1000NCDG@10R@1K
$\text{BM25 (Elastic Search)}$.114.642.279.858.391.971
$\text{IndoBERT}_{\text{CAT}}$.181.642.447.858.455.971