antoinelouis / mono-xm

huggingface.co
Total runs: 30
24-hour runs: 3
7-day runs: 7
30-day runs: 11
Model's Last Updated: March 22 2024
text-classification

Introduction of mono-xm

Model Details of mono-xm

Mono-XM

🛠️ Usage | 📊 Evaluation | 🤖 Training | 🔗 Citation | 💻 Code

This is a multilingual cross-encoder model. It performs cross-attention between a question-passage pair and outputs a relevance score between 0 and 1. The model should be used as a reranker for semantic search: given a query, encode the latter with some candidate passages -- e.g., retrieved with BM25 or a bi-encoder -- then sort the passages in a decreasing order of relevance according to the model's predictions. The model uses an XMOD backbone, which allows it to learn from monolingual fine-tuning in a high-resource language, like English, and performs zero-shot transfer to other languages.

Usage

Here are some examples for using the model with Sentence-Transformers , FlagEmbedding , or Huggingface Transformers .

Using Sentence-Transformers

Start by installing the library : pip install -U sentence-transformers . Then, you can use the model like this:

from sentence_transformers import CrossEncoder

pairs = [
  ('Première question', 'Ceci est un paragraphe pertinent.'),
  ('Voici une autre requête', 'Et voilà un paragraphe non pertinent.'),
]
language_code = "fr_FR" #Find all codes here: https://huggingface.co/facebook/xmod-base#languages

model = CrossEncoder('antoinelouis/mono-xm')
model.model.set_default_language(language_code) #Activate the language-specific adapters

scores = model.predict(pairs)
print(scores)
Using FlagEmbedding

Start by installing the library : pip install -U FlagEmbedding . Then, you can use the model like this:

from FlagEmbedding import FlagReranker

pairs = [
  ('Première question', 'Ceci est un paragraphe pertinent.'),
  ('Voici une autre requête', 'Et voilà un paragraphe non pertinent.'),
]
language_code = "fr_FR" #Find all codes here: https://huggingface.co/facebook/xmod-base#languages

model = FlagReranker('antoinelouis/mono-xm')
model.model.set_default_language(language_code) #Activate the language-specific adapters

scores = model.compute_score(pairs)
print(scores)
Using Transformers

Start by installing the library : pip install -U transformers . Then, you can use the model like this:

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

pairs = [
  ('Première question', 'Ceci est un paragraphe pertinent.'),
  ('Voici une autre requête', 'Et voilà un paragraphe non pertinent.'),
]
language_code = "fr_FR" #Find all codes here: https://huggingface.co/facebook/xmod-base#languages

tokenizer = AutoTokenizer.from_pretrained('antoinelouis/mono-xm')
model = AutoModelForSequenceClassification.from_pretrained('antoinelouis/mono-xm')
model.set_default_language(language_code) #Activate the language-specific adapters

features = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt')
with torch.no_grad():
    scores = model(**features).logits
print(scores)

Evaluation

[to come...]


Training
Data

We use the English training samples from the MS MARCO passage ranking dataset, which contains 8.8M passages and 539K training queries. We use the BM25 negatives provided by the official dataset and sample 1M (q, p) pairs with a 1/4 positive-to-negative ratio (i.e., 250k query-positive pairs for 750k query-negative pairs).

Implementation

The model is initialized from the xmod-base checkpoint and optimized via the binary cross-entropy loss (as in monoBERT ). It is fine-tuned on one 32GB NVIDIA V100 GPU for 5 epochs using the AdamW optimizer with a batch size of 32, a peak learning rate of 2e-5 with warm up along the first 10% of training steps and linear scheduling. We set the maximum sequence lengths for the concatenated question-passage pairs to 512 tokens.


Citation
@article{louis2024modular,
  author = {Louis, Antoine and Saxena, Vageesh and van Dijck, Gijs and Spanakis, Gerasimos},
  title = {ColBERT-XM: A Modular Multi-Vector Representation Model for Zero-Shot Multilingual Information Retrieval},
  journal = {CoRR},
  volume = {abs/2402.15059},
  year = {2024},
  url = {https://arxiv.org/abs/2402.15059},
  doi = {10.48550/arXiv.2402.15059},
  eprinttype = {arXiv},
  eprint = {2402.15059},
}

Runs of antoinelouis mono-xm on huggingface.co

30
Total runs
3
24-hour runs
3
3-day runs
7
7-day runs
11
30-day runs

More Information About mono-xm huggingface.co Model

mono-xm huggingface.co

mono-xm huggingface.co is an AI model on huggingface.co that provides mono-xm's model effect (), which can be used instantly with this antoinelouis mono-xm model. huggingface.co supports a free trial of the mono-xm model, and also provides paid use of the mono-xm. Support call mono-xm model through api, including Node.js, Python, http.

antoinelouis mono-xm online free

mono-xm huggingface.co is an online trial and call api platform, which integrates mono-xm's modeling effects, including api services, and provides a free online trial of mono-xm, you can try mono-xm online for free by clicking the link below.

antoinelouis mono-xm online free url in huggingface.co:

https://huggingface.co/antoinelouis/mono-xm

mono-xm install

mono-xm is an open source model from GitHub that offers a free installation service, and any user can find mono-xm on GitHub to install. At the same time, huggingface.co provides the effect of mono-xm install, users can directly use mono-xm installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

mono-xm install url in huggingface.co:

https://huggingface.co/antoinelouis/mono-xm

Url of mono-xm

Provider of mono-xm huggingface.co

antoinelouis
ORGANIZATIONS

Other API from antoinelouis

huggingface.co

Total runs: 549
Run Growth: 273
Growth Rate: 49.73%
Updated:March 22 2024
huggingface.co

Total runs: 38
Run Growth: -108
Growth Rate: -284.21%
Updated:March 26 2024