layoutlmv2 base uncased finetuned docvqa
Overview
Highlights
- Combines text, layout, and image embeddings for multimodal understanding
- Specialized for high-accuracy Document Visual Question Answering tasks
- Excels at extracting data from semi-structured forms and invoices
- Outperforms text-only models by leveraging spatial document coordinates
Usage
# Install Hugging Face transformers
pip install transformers torch
# Load model with transformers
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa")
tokenizer = AutoTokenizer.from_pretrained("tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa")
Hugging Face Download
We recommend downloading the model via the Hugging Face CLI or Hub SDK.
Guidance:Before downloading, install huggingface_hub with:
pip install -U huggingface_hub
CLI Download
Download the full repository
huggingface-cli download tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa
Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa config.json --local-dir ./dir
See the official docs for more CLI options
SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa')
Git Download
Make sure git-lfs is installed first
git lfs install
git clone https://huggingface.co/tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa
To skip LFS large-file downloads, use:
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa
Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.
PyTorch / Transformers Usage
Install Transformers
pip install -U transformers torch
Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa')
tokenizer = AutoTokenizer.from_pretrained('tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa')
Full Documentation
---
license: cc-by-sa-4.0
tags:
- generated_from_trainer
model-index:
- name: layoutlmv2-base-uncased-finetuned-docvqa
results: []
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
layoutlmv2-base-uncased-finetuned-docvqa
This model is a fine-tuned version of microsoft/layoutlmv2-base-uncased on an unknown dataset.
It achieves the following results on the evaluation set:
- Loss: 1.1940
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 8
- eval_batch_size: 8
- seed: 250500
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 2
Training results
| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-----:|:----:|:---------------:|
| 1.463 | 0.27 | 1000 | 1.6272 |
| 0.9447 | 0.53 | 2000 | 1.3646 |
| 0.7725 | 0.8 | 3000 | 1.2560 |
| 0.5762 | 1.06 | 4000 | 1.3582 |
| 0.4382 | 1.33 | 5000 | 1.2490 |
| 0.4515 | 1.59 | 6000 | 1.1860 |
| 0.383 | 1.86 | 7000 | 1.1940 |
Framework versions
- Transformers 4.12.2
- Pytorch 1.8.0+cu101
- Datasets 1.14.0
- Tokenizers 0.10.3