Instructions to use sneko/crossencoder-camembert-L4-mmarcoFR-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use sneko/crossencoder-camembert-L4-mmarcoFR-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-ranking', 'sneko/crossencoder-camembert-L4-mmarcoFR-onnx');
crossencoder-camembert-L4-mmarcoFR (ONNX)
ONNX export of antoinelouis/crossencoder-camembert-L4-mmarcoFR — a lightweight 4-layer French cross-encoder (distilled from CamemBERT) trained on mMARCO-fr for passage reranking.
All credit for the model goes to the original author. This repository only adds ONNX weights so the model can run with Transformers.js / ONNX Runtime in JavaScript.
This is the 4-layer counterpart of sneko/crossencoder-camembert-base-mmarcoFR-onnx. It trades a bit of ranking quality (mMARCO-fr MRR@10 ≈ 29.2 vs ≈ 33.4 for the base model) for roughly 3× faster CPU inference, which matters a lot when reranking on small, GPU-less instances.
ℹ️ Like the base export, this one includes the sequence-classification head, so it outputs a relevance score (
logitsof shape[batch, 1]) and can actually be used for reranking — not the rawlast_hidden_state.
Files
| File | Description |
|---|---|
onnx/model.onnx |
full precision (fp32), ~206 MB |
onnx/model_quantized.onnx |
int8 dynamic quantization (~52 MB) — loaded by default by Transformers.js |
Usage (Transformers.js)
import { AutoModelForSequenceClassification, AutoTokenizer } from '@xenova/transformers';
const model_id = 'sneko/crossencoder-camembert-L4-mmarcoFR-onnx';
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const model = await AutoModelForSequenceClassification.from_pretrained(model_id); // uses model_quantized.onnx
const query = 'projets dans la police';
const passages = ['Police nationale : métiers, recrutement et concours', 'Plateforme de photographie'];
const inputs = tokenizer(new Array(passages.length).fill(query), { text_pair: passages, padding: true, truncation: true });
const { logits } = await model(inputs);
const scores = logits
.sigmoid()
.tolist()
.map(([s]) => s); // higher = more relevant
How it was produced
optimum-cli export onnx \
--model antoinelouis/crossencoder-camembert-L4-mmarcoFR \
--task text-classification --opset 14 ./out/
# then int8 dynamic quantization (onnxruntime, QUInt8) -> onnx/model_quantized.onnx
License
MIT, following the original model.
- Downloads last month
- 14
Model tree for sneko/crossencoder-camembert-L4-mmarcoFR-onnx
Base model
antoinelouis/camembert-L4