Detect the reading order of a layout-rich document (e.g. receipts, forms, papers) by encoding the word-level bounding boxes in a seq2seq transformer.
Refer to the official Github Repo: https://github.com/microsoft/unilm/tree/master/layoutreader
Trained on ReadingBank.
| Architecture | LayoutlmForSequenceToSequence (LayoutLM backbone) |
| Layers / hidden / heads | 12 / 768 / 12 |
| Parameters | ~113M (207 tensors, fp32) |
| Vocab size | 30522 |
| Max position embeddings | 1024 |
| Max 2D position embeddings | 1024 |
| Max source length | 513 |
model.safetensors / pytorch_model.bin — the same checkpoint in both formatsconfig.jsonNo tokenizer files are included in this repo — load one separately.
The original upload of this repo was saved through a plain BertModel, which
silently dropped every LayoutReader-specific tensor: the 2D layout position
embeddings (x/y/h/w_position_embeddings) and the cls.predictions
head. Its config.json also recorded architectures: ["BertModel"].
main now holds the complete original checkpoint, verified against the source
pytorch_model.bin.
The previous incomplete version is still available at the v1-old tag:
from transformers import AutoModel
AutoModel.from_pretrained("zilongwang/layoutreader-base", revision="v1-old")
pytorch_model.bin 452 MBmodel.safetensors 452 MB