Initial commit
This commit is contained in:
parent
0007979582
commit
1a67f8ef3f
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
language: en
|
||||||
|
license: cc-by-nc-sa-4.0
|
||||||
|
tags:
|
||||||
|
- layoutlm
|
||||||
|
- document-question-answering
|
||||||
|
- pdf
|
||||||
|
- invoices
|
||||||
|
---
|
||||||
|
|
||||||
|
# LayoutLM for Invoices
|
||||||
|
|
||||||
|
This is a fine-tuned version of the multi-modal [LayoutLM](https://aka.ms/layoutlm) model for the task of question answering on invoices and other documents. It has been fine-tuned on a proprietary dataset of
|
||||||
|
invoices as well as both [SQuAD2.0](https://huggingface.co/datasets/squad_v2) and [DocVQA](https://www.docvqa.org/) for general comprehension.
|
||||||
|
|
||||||
|
## Non-consecutive tokens
|
||||||
|
|
||||||
|
Unlike other QA models, which can only extract consecutive tokens (because they predict the start and end of a sequence), this model can predict longer-range, non-consecutive sequences with an additional
|
||||||
|
classifier head. For example, it can extract the two-line address as below:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Getting started with the model
|
||||||
|
|
||||||
|
The best way to use this model is via [DocQuery](https://github.com/impira/docquery).
|
||||||
|
|
||||||
|
## About us
|
||||||
|
|
||||||
|
This model was created by the team at [Impira](https://www.impira.com/).
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"_name_or_path": "impira/layoutlm-document-qa",
|
||||||
|
"architectures": [
|
||||||
|
"LayoutLMForQuestionAnswering"
|
||||||
|
],
|
||||||
|
"attention_probs_dropout_prob": 0.1,
|
||||||
|
"bos_token_id": 0,
|
||||||
|
"classifier_dropout": null,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"gradient_checkpointing": false,
|
||||||
|
"hidden_act": "gelu",
|
||||||
|
"hidden_dropout_prob": 0.1,
|
||||||
|
"hidden_size": 768,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 3072,
|
||||||
|
"layer_norm_eps": 1e-05,
|
||||||
|
"max_2d_position_embeddings": 1024,
|
||||||
|
"max_position_embeddings": 514,
|
||||||
|
"model_type": "layoutlm-docquery",
|
||||||
|
"num_attention_heads": 12,
|
||||||
|
"num_hidden_layers": 12,
|
||||||
|
"pad_token_id": 1,
|
||||||
|
"position_embedding_type": "absolute",
|
||||||
|
"tokenizer_class": "RobertaTokenizer",
|
||||||
|
"token_classification": true,
|
||||||
|
"token_classifier_reduction": "sum",
|
||||||
|
"token_classifier_constant": 0.1,
|
||||||
|
"transformers_version": "4.22.0.dev0",
|
||||||
|
"type_vocab_size": 1,
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 50265
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
||||||
|
[tool.black]
|
||||||
|
line-length = 119
|
||||||
|
target-version = ['py35']
|
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6e540e17254272534b7868382a0fb05ddc693789938fa4bb2fc6aac29dbc0a83
|
||||||
|
size 511251617
|
|
@ -0,0 +1,18 @@
|
||||||
|
[isort]
|
||||||
|
default_section = FIRSTPARTY
|
||||||
|
ensure_newline_before_comments = True
|
||||||
|
force_grid_wrap = 0
|
||||||
|
include_trailing_comma = True
|
||||||
|
known_first_party = transformers
|
||||||
|
|
||||||
|
line_length = 119
|
||||||
|
lines_after_imports = 2
|
||||||
|
multi_line_output = 3
|
||||||
|
use_parentheses = True
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
ignore = E203, E501, E741, W503, W605
|
||||||
|
max-line-length = 119
|
||||||
|
|
||||||
|
[tool:pytest]
|
||||||
|
doctest_optionflags=NUMBER NORMALIZE_WHITESPACE ELLIPSIS
|
|
@ -0,0 +1 @@
|
||||||
|
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
||||||
|
{"unk_token": "<unk>", "bos_token": "<s>", "eos_token": "</s>", "add_prefix_space": false, "errors": "replace", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": "<mask>", "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "roberta-base"}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue