Instructions to use chaouin/qfrblima-bert-base-cased with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chaouin/qfrblima-bert-base-cased with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="chaouin/qfrblima-bert-base-cased")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("chaouin/qfrblima-bert-base-cased") model = AutoModelForSequenceClassification.from_pretrained("chaouin/qfrblima-bert-base-cased", device_map="auto") - Notebooks
- Google Colab
- Kaggle
QFrBLiMa — BERT-base-cased
A supervised regional French classifier fine-tuned from BERT-base-cased to distinguish Metropolitan French (MFr) and Quebec French (QFr) for research purposes. It is one of five classifiers evaluated on QFrBLiMa, a contrastive benchmark of regional linguistic markers.
Code and experimental results: GitHub.
Usage
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_id = "chaouin/qfrblima-bert-base-cased"
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=True)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()
texts = [
"J'ai terminé le puzzle hier soir.",
"J'ai terminé le casse-tête hier soir.",
]
inputs = tokenizer(texts, padding=True, truncation=True,
max_length=128, return_tensors="pt")
with torch.inference_mode():
scores = model(**inputs).logits.softmax(dim=-1)[:, 1]
print(scores.tolist()) # QFr scores
print("QFr sentence ranked higher:", (scores[1] > scores[0]).item())
| Class ID | Variety | Legacy model label |
|---|---|---|
| 0 | Metropolitan French (MFr) | FI |
| 1 | Quebec French (QFr) | FQ |
The softmax scores have not been calibrated. For contrastive evaluation, a pair is correct when the QFr sentence receives a strictly higher class-1 score than its MFr counterpart; ties count as incorrect.
Training
The model was fine-tuned on a separate supervised corpus of 938,484 examples (751,288 training, 93,768 validation and 93,428 test), balanced by variety within each of six genres and each partition. Training used three epochs, an effective batch size of 32, a learning rate of 2e-5, a maximum sequence length of 128 and seed 42. The checkpoint from epoch 3 was selected by validation macro-F1.
QFrBLiMa was used only for external evaluation, not for fine-tuning or checkpoint selection. Following Khan et al. (2026), the supervised corpus and its splits are not publicly redistributed. See the corpus documentation for provenance, usage restrictions and reconstruction limitations.
Evaluation
| Metric | Result |
|---|---|
| Internal test macro-F1 | 95.45% |
| QFrBLiMa sentence accuracy | 53.78% |
| QFrBLiMa sentence macro-F1 | 52.44% |
| QFrBLiMa strict pairwise accuracy | 58.01% |
| Strict pairwise accuracy (95% CI) | 52.78%–63.07% |
External evaluation covers 1,205 contrastive pairs, 241 markers and five contexts per marker. Sentence-level classification uses a threshold of 0.5. The confidence interval is based on 20,000 bootstrap replicates clustered by linguistic marker. Full predictions and analyses are available in the GitHub repository.
Limitations and intended use
The model is intended for research on regional linguistic recognition, not for inferring a person's origin or identity. Source-based training labels are imperfect proxies for linguistic usage; neither variety implies exclusive geographic usage. High internal classification scores do not guarantee contrastive recognition or generalization to other domains. Exact reconstruction of the supervised corpus has not been verified.
License and Citation
This model is distributed under the Apache License 2.0, consistent with the license of the original pretrained model.
If you use this classifier, please cite the QFrBLiMa paper and the original BERT work.
- Downloads last month
- 6
Model tree for chaouin/qfrblima-bert-base-cased
Base model
google-bert/bert-base-cased