Token Classification
Transformers
Safetensors
layoutlmv3
ner
on-device
privacy
flowx
openner
cross
de-identification
Instructions to use flowxai/docformner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flowxai/docformner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="flowxai/docformner")# Load model directly from transformers import AutoProcessor, AutoModelForTokenClassification processor = AutoProcessor.from_pretrained("flowxai/docformner") model = AutoModelForTokenClassification.from_pretrained("flowxai/docformner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add OpenNER model, card, NOTICE (Apache-2.0, FlowX.AI)
Browse files- NOTICE +8 -0
- README.md +45 -0
- config.json +82 -0
- metrics.json +11 -0
- model.safetensors +3 -0
- processor_config.json +27 -0
- tokenizer.json +0 -0
- tokenizer_config.json +38 -0
- training_args.bin +3 -0
NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FlowX OpenNER
|
| 2 |
+
Copyright 2026 FlowX.AI
|
| 3 |
+
|
| 4 |
+
This product includes software and models developed at FlowX.AI (https://flowx.ai).
|
| 5 |
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these
|
| 6 |
+
files except in compliance with the License. You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: token-classification
|
| 5 |
+
base_model: microsoft/layoutlmv3-base
|
| 6 |
+
tags:
|
| 7 |
+
- ner
|
| 8 |
+
- on-device
|
| 9 |
+
- privacy
|
| 10 |
+
- flowx
|
| 11 |
+
- openner
|
| 12 |
+
- cross
|
| 13 |
+
- de-identification
|
| 14 |
+
- token-classification
|
| 15 |
+
metrics:
|
| 16 |
+
- f1
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# DocFormNER
|
| 20 |
+
|
| 21 |
+
**DocFormNER** is a small, on-device cross NER model from the FlowX **OpenNER** family. Developed by **FlowX.AI**. Runs 100% on-premise / air-gapped, so no data leaves your boundary.
|
| 22 |
+
|
| 23 |
+
## What it does
|
| 24 |
+
- **Task:** token-classification
|
| 25 |
+
- **Base model:** `microsoft/layoutlmv3-base`
|
| 26 |
+
- **Entity types (9):** APP_NO, BORROWER, INCOME, INTEREST_RATE, LENDER, LOAN_AMOUNT, LTV, PROPERTY_ADDR, TERM_YEARS
|
| 27 |
+
- **Held-out F1:** 1.0000
|
| 28 |
+
- **Runtime:** CPU, Apple Silicon, one GPU, or browser/edge via ONNX (INT8). ~100-160 ms/doc on CPU.
|
| 29 |
+
|
| 30 |
+
## Why a small model
|
| 31 |
+
Fine-tuned encoders match or beat frontier LLMs on structured, convention-bound extraction, at a fraction of the latency and cost, with **zero data egress**. Identifiers are validated by checksum (IBAN mod-97, card Luhn, ISIN/LEI, container ISO-6346, VIN, national IDs), a correctness guarantee general LLMs lack. See the FlowX OpenNER benchmark for measured results.
|
| 32 |
+
|
| 33 |
+
> **Document-AI preview.** DocFormNER is a **LayoutLMv3** model that reads text + 2D layout + the page image, so it works on scanned / photographed forms (mortgage packets, bills of lading, ACORD forms). This checkpoint is trained on **synthetic rendered forms** as a walking skeleton; for production, fine-tune on real OCR'd documents (FUNSD / DocLayNet / CORD or your own scans) with the same `{words, bboxes, labels, image}` shape.
|
| 34 |
+
|
| 35 |
+
## Usage
|
| 36 |
+
```python
|
| 37 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 38 |
+
tok = AutoTokenizer.from_pretrained("flowxai/docformner")
|
| 39 |
+
model = AutoModelForTokenClassification.from_pretrained("flowxai/docformner")
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## License & attribution
|
| 43 |
+
Licensed under the **Apache License 2.0**. Copyright 2026 **FlowX.AI** (https://flowx.ai). See the `NOTICE` file. Trained on synthetic, checksum-validated data.
|
| 44 |
+
|
| 45 |
+
_Part of the FlowX OpenNER model family. Synthetic-data F1 reflects an in-distribution synthetic distribution; validate on real documents before production use._
|
config.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LayoutLMv3ForTokenClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": 0,
|
| 7 |
+
"classifier_dropout": null,
|
| 8 |
+
"coordinate_size": 128,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"has_relative_attention_bias": true,
|
| 12 |
+
"has_spatial_attention_bias": true,
|
| 13 |
+
"hidden_act": "gelu",
|
| 14 |
+
"hidden_dropout_prob": 0.1,
|
| 15 |
+
"hidden_size": 768,
|
| 16 |
+
"id2label": {
|
| 17 |
+
"0": "O",
|
| 18 |
+
"1": "B-BORROWER",
|
| 19 |
+
"2": "I-BORROWER",
|
| 20 |
+
"3": "B-LENDER",
|
| 21 |
+
"4": "I-LENDER",
|
| 22 |
+
"5": "B-PROPERTY_ADDR",
|
| 23 |
+
"6": "I-PROPERTY_ADDR",
|
| 24 |
+
"7": "B-LOAN_AMOUNT",
|
| 25 |
+
"8": "I-LOAN_AMOUNT",
|
| 26 |
+
"9": "B-LTV",
|
| 27 |
+
"10": "I-LTV",
|
| 28 |
+
"11": "B-INTEREST_RATE",
|
| 29 |
+
"12": "I-INTEREST_RATE",
|
| 30 |
+
"13": "B-TERM_YEARS",
|
| 31 |
+
"14": "I-TERM_YEARS",
|
| 32 |
+
"15": "B-APP_NO",
|
| 33 |
+
"16": "I-APP_NO",
|
| 34 |
+
"17": "B-INCOME",
|
| 35 |
+
"18": "I-INCOME"
|
| 36 |
+
},
|
| 37 |
+
"initializer_range": 0.02,
|
| 38 |
+
"input_size": 224,
|
| 39 |
+
"intermediate_size": 3072,
|
| 40 |
+
"label2id": {
|
| 41 |
+
"B-APP_NO": 15,
|
| 42 |
+
"B-BORROWER": 1,
|
| 43 |
+
"B-INCOME": 17,
|
| 44 |
+
"B-INTEREST_RATE": 11,
|
| 45 |
+
"B-LENDER": 3,
|
| 46 |
+
"B-LOAN_AMOUNT": 7,
|
| 47 |
+
"B-LTV": 9,
|
| 48 |
+
"B-PROPERTY_ADDR": 5,
|
| 49 |
+
"B-TERM_YEARS": 13,
|
| 50 |
+
"I-APP_NO": 16,
|
| 51 |
+
"I-BORROWER": 2,
|
| 52 |
+
"I-INCOME": 18,
|
| 53 |
+
"I-INTEREST_RATE": 12,
|
| 54 |
+
"I-LENDER": 4,
|
| 55 |
+
"I-LOAN_AMOUNT": 8,
|
| 56 |
+
"I-LTV": 10,
|
| 57 |
+
"I-PROPERTY_ADDR": 6,
|
| 58 |
+
"I-TERM_YEARS": 14,
|
| 59 |
+
"O": 0
|
| 60 |
+
},
|
| 61 |
+
"layer_norm_eps": 1e-05,
|
| 62 |
+
"max_2d_position_embeddings": 1024,
|
| 63 |
+
"max_position_embeddings": 514,
|
| 64 |
+
"max_rel_2d_pos": 256,
|
| 65 |
+
"max_rel_pos": 128,
|
| 66 |
+
"model_type": "layoutlmv3",
|
| 67 |
+
"num_attention_heads": 12,
|
| 68 |
+
"num_channels": 3,
|
| 69 |
+
"num_hidden_layers": 12,
|
| 70 |
+
"pad_token_id": 1,
|
| 71 |
+
"patch_size": 16,
|
| 72 |
+
"rel_2d_pos_bins": 64,
|
| 73 |
+
"rel_pos_bins": 32,
|
| 74 |
+
"second_input_size": 112,
|
| 75 |
+
"shape_size": 128,
|
| 76 |
+
"text_embed": true,
|
| 77 |
+
"transformers_version": "5.14.1",
|
| 78 |
+
"type_vocab_size": 1,
|
| 79 |
+
"use_cache": false,
|
| 80 |
+
"visual_embed": true,
|
| 81 |
+
"vocab_size": 50265
|
| 82 |
+
}
|
metrics.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"test_loss": 7.649723556824028e-05,
|
| 3 |
+
"test_precision": 1.0,
|
| 4 |
+
"test_recall": 1.0,
|
| 5 |
+
"test_f1": 1.0,
|
| 6 |
+
"test_accuracy": 1.0,
|
| 7 |
+
"test_runtime": 64.0196,
|
| 8 |
+
"test_samples_per_second": 15.62,
|
| 9 |
+
"test_steps_per_second": 1.953,
|
| 10 |
+
"epoch": 4.0
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e5c7d23ea9f7dff640f4dd922dd0ff2a803c31026524fbea4d0381cd139b36f
|
| 3 |
+
size 503755044
|
processor_config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"apply_ocr": false,
|
| 4 |
+
"do_normalize": true,
|
| 5 |
+
"do_rescale": true,
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.5,
|
| 9 |
+
0.5,
|
| 10 |
+
0.5
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "LayoutLMv3ImageProcessor",
|
| 13 |
+
"image_std": [
|
| 14 |
+
0.5,
|
| 15 |
+
0.5,
|
| 16 |
+
0.5
|
| 17 |
+
],
|
| 18 |
+
"resample": 2,
|
| 19 |
+
"rescale_factor": 0.00392156862745098,
|
| 20 |
+
"size": {
|
| 21 |
+
"height": 224,
|
| 22 |
+
"width": 224
|
| 23 |
+
},
|
| 24 |
+
"tesseract_config": ""
|
| 25 |
+
},
|
| 26 |
+
"processor_class": "LayoutLMv3Processor"
|
| 27 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"apply_ocr": false,
|
| 4 |
+
"backend": "tokenizers",
|
| 5 |
+
"bos_token": "<s>",
|
| 6 |
+
"cls_token": "<s>",
|
| 7 |
+
"cls_token_box": [
|
| 8 |
+
0,
|
| 9 |
+
0,
|
| 10 |
+
0,
|
| 11 |
+
0
|
| 12 |
+
],
|
| 13 |
+
"eos_token": "</s>",
|
| 14 |
+
"errors": "replace",
|
| 15 |
+
"is_local": false,
|
| 16 |
+
"local_files_only": false,
|
| 17 |
+
"mask_token": "<mask>",
|
| 18 |
+
"model_max_length": 512,
|
| 19 |
+
"only_label_first_subword": true,
|
| 20 |
+
"pad_token": "<pad>",
|
| 21 |
+
"pad_token_box": [
|
| 22 |
+
0,
|
| 23 |
+
0,
|
| 24 |
+
0,
|
| 25 |
+
0
|
| 26 |
+
],
|
| 27 |
+
"pad_token_label": -100,
|
| 28 |
+
"processor_class": "LayoutLMv3Processor",
|
| 29 |
+
"sep_token": "</s>",
|
| 30 |
+
"sep_token_box": [
|
| 31 |
+
0,
|
| 32 |
+
0,
|
| 33 |
+
0,
|
| 34 |
+
0
|
| 35 |
+
],
|
| 36 |
+
"tokenizer_class": "LayoutLMv3Tokenizer",
|
| 37 |
+
"unk_token": "<unk>"
|
| 38 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79e8cf32e3fc6ee1bac025bcfdacecadc4ef37a171a5899de2e652de10d7c9c8
|
| 3 |
+
size 5201
|