This is a
SPLADE-max
model for
French
that can be used for semantic search. The model maps queries and passages to
32k-dimensional sparse vectors which are used to compute relevance through cosine similarity.
Usage
Start by installing the
library
:
pip install -U transformers
. Then, you can use the model like this:
import torch
from torch.nn.functional import relu, normalize
from transformers import AutoTokenizer, AutoModel
queries = ["Ceci est un exemple de requête.", "Voici un second exemple."]
passages = ["Ceci est un exemple de passage.", "Et voilà un deuxième exemple."]
tokenizer = AutoTokenizer.from_pretrained('antoinelouis/spladev2-camembert-base-mmarcoFR')
model = AutoModel.from_pretrained('antoinelouis/spladev2-camembert-base-mmarcoFR')
q_input = tokenizer(queries, padding=True, truncation=True, return_tensors='pt')
p_input = tokenizer(passages, padding=True, truncation=True, return_tensors='pt')
with torch.no_grad():
q_output = model(**q_input)
p_output = model(**p_input)
q_activations = torch.amax(torch.log1p(relu(q_output.logits * q_input['attention_mask'].unsqueeze(-1))), dim=1)
p_activations = torch.amax(torch.log1p(relu(p_output.logits * p_input['attention_mask'].unsqueeze(-1))), dim=1)
q_activations = normalize(q_activations, p=2, dim=1)
p_activations = normalize(p_activations, p=2, dim=1)
similarity = q_embeddings @ p_embeddings.T
print(similarity)
Evaluation
The model is evaluated on the smaller development set of
mMARCO-fr
, which consists of 6,980 queries for a corpus of
8.8M candidate passages. We report the mean reciprocal rank (MRR), normalized discounted cumulative gainand (NDCG), mean average precision (MAP), and recall at various cut-offs (R@k).
To see how it compares to other neural retrievers in French, check out the
DécouvrIR
leaderboard.
Training
Data
The model is trained on the French training samples of the
mMARCO
dataset, a multilingual machine-translated version of MS MARCO that
contains 8.8M passages and 539K training queries. We sample 12.8M (q, p+, p-) triples from the official ~39.8M
training triples
with BM25 negatives.
Implementation
The model is initialized from the
almanach/camembert-base
checkpoint and optimized via a combination of the InfoNCE
ranking loss with a temperature of 0.05 and the FLOPS regularization loss with quadratic increase of lambda until step 33k after which it remains constant with lambda_q=3e-4
and lambda_d=1e-4. The model is fine-tuned on one 80GB NVIDIA H100 GPU for 100k steps using the AdamW optimizer with a batch size of 128, a peak learning rate
of 2e-5 with warm up along the first 4000 steps and linear scheduling. The maximum sequence lengths for questions and passages length were fixed to 32 and 128 tokens.
Relevance scores are computed with the cosine similarity.
Citation
@online{louis2024decouvrir,
author = 'Antoine Louis',
title = 'DécouvrIR: A Benchmark for Evaluating the Robustness of Information Retrieval Models in French',
publisher = 'Hugging Face',
month = 'mar',
year = '2024',
url = 'https://huggingface.co/spaces/antoinelouis/decouvrir',
}
Runs of antoinelouis spladev2-camembert-base-mmarcoFR on huggingface.co
124
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About spladev2-camembert-base-mmarcoFR huggingface.co Model
More spladev2-camembert-base-mmarcoFR license Visit here:
spladev2-camembert-base-mmarcoFR huggingface.co is an AI model on huggingface.co that provides spladev2-camembert-base-mmarcoFR's model effect (), which can be used instantly with this antoinelouis spladev2-camembert-base-mmarcoFR model. huggingface.co supports a free trial of the spladev2-camembert-base-mmarcoFR model, and also provides paid use of the spladev2-camembert-base-mmarcoFR. Support call spladev2-camembert-base-mmarcoFR model through api, including Node.js, Python, http.
spladev2-camembert-base-mmarcoFR huggingface.co is an online trial and call api platform, which integrates spladev2-camembert-base-mmarcoFR's modeling effects, including api services, and provides a free online trial of spladev2-camembert-base-mmarcoFR, you can try spladev2-camembert-base-mmarcoFR online for free by clicking the link below.
antoinelouis spladev2-camembert-base-mmarcoFR online free url in huggingface.co:
spladev2-camembert-base-mmarcoFR is an open source model from GitHub that offers a free installation service, and any user can find spladev2-camembert-base-mmarcoFR on GitHub to install. At the same time, huggingface.co provides the effect of spladev2-camembert-base-mmarcoFR install, users can directly use spladev2-camembert-base-mmarcoFR installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
spladev2-camembert-base-mmarcoFR install url in huggingface.co: