Instructions to use AvoCahDoe/sommaire-layoutlmv3-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AvoCahDoe/sommaire-layoutlmv3-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="AvoCahDoe/sommaire-layoutlmv3-classifier")# Load model directly from transformers import AutoProcessor, AutoModelForSequenceClassification processor = AutoProcessor.from_pretrained("AvoCahDoe/sommaire-layoutlmv3-classifier") model = AutoModelForSequenceClassification.from_pretrained("AvoCahDoe/sommaire-layoutlmv3-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
SommaireTOC Segment Classifier — LayoutLMv3 (gated)
Fine-tuned microsoft/layoutlmv3-base for segment-level layout classification on French Bulletin Officiel (BO) SOMMAIRE / TOC pages.
Each annotated region (page crop image + OCR words + word boxes) is encoded as one sequence; the model predicts one of 9 layout classes (LayoutLMv3ForSequenceClassification).
Gated model — trained on proprietary/internal BO annotations. Best weights from run
run_20260809_031930(checkpoint-21990 / epoch 15).
Model description
| Property | Value |
|---|---|
| Architecture | LayoutLMv3ForSequenceClassification |
| Base model | microsoft/layoutlmv3-base |
| Task | Segment-level sequence classification |
| Classes | 9 SommaireTOC layout roles |
| Input | Page/region image + word tokens + word boxes (0–1000) |
| Parameters | ~126M |
| Best checkpoint | checkpoint-21990 (epoch 15) |
| Selection metric | eval_f1_macro |
Layout classes (9)
| id | label | Role |
|---|---|---|
| 0 | Titre |
TOC title line |
| 1 | Page_title |
Page number associated with a title |
| 2 | Som_Section |
Section banner inside sommaire |
| 3 | Sommaire |
SOMMAIRE header / banner |
| 4 | Page |
Standalone page number |
| 5 | Meta_Data |
Header/footer metadata |
| 6 | Tex_PAR |
Text block — PARTICULIER |
| 7 | Tex_GEN |
Text block — GENERAL |
| 8 | Tex_AVIS |
Text block — AVIS |
Training data
| Item | Value |
|---|---|
| Segments (pipeline scale) | 15,398 |
| Corrected GT titles (ref) | 3,697 |
| Task | sommaire_segment_classification |
| Run id | run_20260809_031930 |
| Domain | French Bulletin Officiel SOMMAIRE pages |
Training hyperparameters
| Parameter | Value |
|---|---|
| Epochs requested | 30 |
| Epochs to best | 15 (early stopping patience 5; run stopped ~20) |
| Batch size (per device) | 4 |
| Gradient accumulation | 2 |
| Effective batch size | 8 |
| Learning rate | 2e-5 |
| Warmup ratio | 0.1 |
| Weight decay | 0.01 |
| FP16 | true |
| Optimizer metric | f1_macro |
| Best val F1 macro | 0.9680 |
| Best global step | 21990 |
Summaries: metrics/trainer_summary.json, metrics/val_best_metrics.json
Evaluation results
Held-out test set (n=1800)
From metrics/test_metrics.json:
| Metric | Value |
|---|---|
| Accuracy | 0.9867 |
| F1 macro | 0.9738 |
| F1 micro | 0.9867 |
| F1 weighted | 0.9867 |
| Precision macro | 0.9700 |
| Recall macro | 0.9790 |
| Mean confidence | 0.9971 |
Per-class F1 (test)
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| Meta_Data | 1.00 | 0.99 | 0.994 | 90 |
| Page | 0.94 | 0.95 | 0.945 | 100 |
| Page_title | 0.99 | 0.99 | 0.989 | 593 |
| Som_Section | 0.98 | 0.97 | 0.978 | 231 |
| Sommaire | 1.00 | 0.99 | 0.995 | 96 |
| Tex_AVIS | 0.88 | 1.00 | 0.933 | 7 |
| Tex_GEN | 1.00 | 0.92 | 0.960 | 26 |
| Tex_PAR | 0.95 | 1.00 | 0.974 | 38 |
| Titre | 1.00 | 0.99 | 0.994 | 619 |
Validation (best checkpoint)
| Metric | Value |
|---|---|
| F1 macro | 0.9680 |
| Accuracy | 0.9861 |
| Epoch | 15 |
Plots
Example pages
Usage
from transformers import AutoProcessor, LayoutLMv3ForSequenceClassification
import torch
from PIL import Image
repo = "AvoCahDoe/sommaire-layoutlmv3-classifier"
processor = AutoProcessor.from_pretrained(repo, apply_ocr=False)
model = LayoutLMv3ForSequenceClassification.from_pretrained(repo)
model.eval()
image = Image.open("region_crop.png").convert("RGB")
# words / boxes: list[str], list[list[int]] normalized 0–1000
encoding = processor(
image,
words=words,
boxes=boxes,
return_tensors="pt",
truncation=True,
padding="max_length",
max_length=512,
)
with torch.no_grad():
logits = model(**encoding).logits
pred_id = int(logits.argmax(-1).item())
print(model.config.id2label[pred_id])
Repository layout
model.safetensors, config.json
tokenizer / preprocessor files
metrics/ # test, val, run_config
plots/ # curves + confusion / comparisons
examples/ # BO page images
Intended use
- Classification stage of SommaireTOC after region proposal
- Labels feed title / page extraction and
pdf_page → BO_pagemapping
Limitations
- Tuned for French BO SOMMAIRE segments; other layouts may degrade
- Rare classes (
Tex_AVIS) have low support in test - Private weights; do not redistribute without authorization
- Requires word-level OCR + boxes (processor
apply_ocr=Falsein the snippet above)
Related models
- Region proposal:
AvoCahDoe/sommaire-pp-doclayout-l-proposal - Earlier public segment classifier:
AvoCahDoe/layoutlmv3-bo-segments
Citation
If you use this model in work derived from the SommaireTOC pipeline, please cite the Hub repo and base model microsoft/layoutlmv3-base.
- Downloads last month
- -
Model tree for AvoCahDoe/sommaire-layoutlmv3-classifier
Base model
microsoft/layoutlmv3-baseSpace using AvoCahDoe/sommaire-layoutlmv3-classifier 1
Evaluation results
- F1 macro (test) on SommaireTOC BO segments (held-out test, n=1800)self-reported0.974
- Accuracy (test) on SommaireTOC BO segments (held-out test, n=1800)self-reported0.987
- F1 micro (test) on SommaireTOC BO segments (held-out test, n=1800)self-reported0.987
- F1 weighted (test) on SommaireTOC BO segments (held-out test, n=1800)self-reported0.987
- F1 macro (val, best) on SommaireTOC BO segments (val)self-reported0.968
- Accuracy (val, best) on SommaireTOC BO segments (val)self-reported0.986
- Best epoch on SommaireTOC BO segments (val)self-reported15.000








