Fill-Mask
Transformers
Safetensors
English
modernlayoutlm
document-understanding
layoutlm
modernbert
custom_code
Run this model with HF Jobs
Run kkuroma/ModernLayoutLM on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/kkuroma/ModernLayoutLM. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/kkuroma/ModernLayoutLM on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use kkuroma/ModernLayoutLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kkuroma/ModernLayoutLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="kkuroma/ModernLayoutLM", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("kkuroma/ModernLayoutLM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse filesFiles changed (3)
- .gitattributes+1
- README.md+22-4
- performance.pngAdded
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textperformance.png filter=lfs diff=lfs merge=lfs -text
12 unmodified lines13141516171854 unmodified lines7374757677787912 unmodified lines9293949596977 unmodified lines1051061071081091101111121131141151 unmodified line11711811912012112212 unmodified lines# ModernLayoutLMModernLayoutLM is an attempt to produce a long-context (like ModernBERT) bidirectional encoder that incorporates layout information into its training (like LayoutLM). ModernLayoutLM uses the same recipe as Xu et al. (2020) in the creation of LayoutLMv1, where the major difference is swapping BERT with ModernBERT (Warner et al., 2024).## Intended use54 unmodified lines### FUNSD- Source: Jaume et al. (2019), read from `nielsr/funsd-layoutlmv3`- Released: 2019- Size: 199 scanned forms, 149 train and 50 test- Task: entity labeling over header, question and answer, as 7 BIO labels12 unmodified lines- Size: 973 receipts, 594 train, 32 validation and 347 test- Task: key information extraction over company, date, address and total, as 9 BIO labels### ResultsEach column is one model fine-tuned on identical data.7 unmodified lines| setting | value ||---|---|| metric | entity F1, and field-level Hmean per ICDAR task 3 on SROIE || seeds | mean ± standard deviation over three seeds || split | FUNSD on test as it has no validation split, the rest on validation || learning rate | 3e-4, chosen on FUNSD test, and 5e-5 for LayoutLMv1 as in its paper || epochs | 30 || window | 1024 tokens, 512 for LayoutLMv1 as its positions cap there || long documents | chunks are stitched back into one document before scoring || dataset | ModernLayoutLM | LayoutLMv1 | ModernLayoutLM (no-pretrain) | ModernLayoutLM (no-bbox) | ModernBERT |1 unmodified line| FUNSD | 0.7565 ± 0.0037 | 0.7785 ± 0.0104 | 0.5939 ± 0.0205 | 0.3000 ± 0.0247 | 0.5884 ± 0.0082 || CORD | 0.9546 ± 0.0023 | 0.9685 ± 0.0037 | 0.9462 ± 0.0050 | 0.9312 ± 0.0042 | 0.9424 ± 0.0006 || SROIE | 0.9337 ± 0.0060 | 0.9223 ± 0.0199 | 0.8883 ± 0.0121 | 0.8411 ± 0.0189 | 0.8955 ± 0.0072 |ModernLayoutLM performs comparably to LayoutLMv1, but natively supports long context.12 unmodified lines131415161718192054 unmodified lines7576777879808112 unmodified lines9495969798991001011021031041051061071081091101111127 unmodified lines1201211221231241251261271281291301 unmodified line13213313413513613713813914012 unmodified lines# ModernLayoutLMModernLayoutLM is an attempt to produce a long-context (like ModernBERT) bidirectional encoder that incorporates layout information into its training (like LayoutLM). ModernLayoutLM uses the same recipe as Xu et al. (2020) in the creation of LayoutLMv1, where the major difference is swapping BERT with ModernBERT (Warner et al., 2024).## Intended use54 unmodified lines### FUNSD- Source: Jaume et al. (2019), read from `nielsr/funsd`- Released: 2019- Size: 199 scanned forms, 149 train and 50 test- Task: entity labeling over header, question and answer, as 7 BIO labels12 unmodified lines- Size: 973 receipts, 594 train, 32 validation and 347 test- Task: key information extraction over company, date, address and total, as 9 BIO labels### RealKIE- Source: Townsend et al. (2024), the FCC Invoices, NDA and Charities sets, read from the Zenodo release with its own OCR- Released: 2024- Size: long multi-page documents, 38% to 55% of them past 4096 tokens- Task: key information extraction labeled as character spans over the OCR text| set | train, validation and test documents | fields | BIO labels | median tokens ||---|---|---|---|---|| FCC Invoices | 221, 75 and 74 | 11 | 23 | 2,948 || NDA | 248, 93 and 98 | 3 | 7 | 3,522 || Charities | 322, 108 and 108 | 28 | 57 | 4,525 |### ResultsEach column is one model fine-tuned on identical data.7 unmodified lines| setting | value ||---|---|| metric | entity F1, and field-level Hmean per ICDAR task 3 on SROIE || seeds | mean ± standard deviation over three seeds, one seed on RealKIE || split | FUNSD on test as it has no validation split, the rest on validation || learning rate | 3e-4, chosen on FUNSD test, and 5e-5 for LayoutLMv1 as in its paper || epochs | 30, 10 on RealKIE || window | 1024 tokens, 4096 on RealKIE, 512 for LayoutLMv1 as its positions cap there || long documents | chunks are stitched back into one document before scoring || dataset | ModernLayoutLM | LayoutLMv1 | ModernLayoutLM (no-pretrain) | ModernLayoutLM (no-bbox) | ModernBERT |1 unmodified line| FUNSD | 0.7565 ± 0.0037 | 0.7785 ± 0.0104 | 0.5939 ± 0.0205 | 0.3000 ± 0.0247 | 0.5884 ± 0.0082 || CORD | 0.9546 ± 0.0023 | 0.9685 ± 0.0037 | 0.9462 ± 0.0050 | 0.9312 ± 0.0042 | 0.9424 ± 0.0006 || SROIE | 0.9337 ± 0.0060 | 0.9223 ± 0.0199 | 0.8883 ± 0.0121 | 0.8411 ± 0.0189 | 0.8955 ± 0.0072 || RealKIE FCC | 0.8761 | 0.8613 | 0.8569 | 0.7178 | 0.8607 || RealKIE NDA | 0.8586 | 0.8539 | 0.8503 | 0.5735 | 0.8571 || RealKIE Charities | 0.8043 | 0.8071 | 0.7679 | 0.3740 | 0.7725 |ModernLayoutLM performs comparably to LayoutLMv1, but natively supports long context.
.gitattributes+1
README.md+22-4
performance.pngAdded

Large File Pointer Details
- SHA256: 17eb9a900d8b54655d1a520ed871573cc2369a97de7592017031bdd9c439360e
- Pointer size: 131 Bytes
- Size of remote file: 380 kB