Run this model with HF Jobs
Run rubentito/bert-large-mpdocvqa 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/rubentito/bert-large-mpdocvqa. 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/rubentito/bert-large-mpdocvqa 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 rubentito/bert-large-mpdocvqa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rubentito/bert-large-mpdocvqa with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "question-answering" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("question-answering", model="rubentito/bert-large-mpdocvqa")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("rubentito/bert-large-mpdocvqa") model = AutoModelForQuestionAnswering.from_pretrained("rubentito/bert-large-mpdocvqa", device_map="auto") - Notebooks
- Google Colab
- Kaggle
BERT large fine-tuned on MP-DocVQA
This is BERT trained on SinglePage DocVQA and fine-tuned on Multipage DocVQA (MP-DocVQA) dataset.
This model was used as a baseline in Hierarchical multimodal transformers for Multi-Page DocVQA.
- Training hyperparameters can be found in Table 8 of Appendix D.
How to use
Inference
How to use this model to perform inference on a sample question and context in PyTorch:
from transformers import AutoModelForQuestionAnswering, AutoTokenizer
model = AutoModelForQuestionAnswering.from_pretrained("rubentito/bert-large-mpdocvqa")
tokenizer = AutoTokenizer.from_pretrained("rubentito/bert-large-mpdocvqa")
question = "Replace me by any text you'd like."
context = "Put some context for answering"
encoded_input = tokenizer(question, context, return_tensors='pt')
output = model(**encoded_input)
start_pos = torch.argmax(output.start_logits, dim=-1).item()
end_pos = torch.argmax(output.end_logits.argmax, dim=-1).item()
pred_answer = context[start_pos:end_pos]
Metrics
Average Normalized Levenshtein Similarity (ANLS)
The standard metric for text-based VQA tasks (ST-VQA and DocVQA). It evaluates the method's reasoning capabilities while smoothly penalizes OCR recognition errors. Check Scene Text Visual Question Answering for detailed information.
Answer Page Prediction Accuracy (APPA)
In the MP-DocVQA task, the models can provide the index of the page where the information required to answer the question is located. For this subtask accuracy is used to evaluate the predictions: i.e. if the predicted page is correct or not. Check Hierarchical multimodal transformers for Multi-Page DocVQA for detailed information.
Model results
Extended experimentation can be found in Table 2 of Hierarchical multimodal transformers for Multi-Page DocVQA. You can also check the live leaderboard at the RRC Portal.
| Model | HF name | Parameters | ANLS | APPA |
|---|---|---|---|---|
| Bert large | rubentito/bert-large-mpdocvqa | 334M | 0.4183 | 51.6177 |
| Longformer base | rubentito/longformer-base-mpdocvqa | 148M | 0.5287 | 71.1696 |
| BigBird ITC base | rubentito/bigbird-base-itc-mpdocvqa | 131M | 0.4929 | 67.5433 |
| LayoutLMv3 base | rubentito/layoutlmv3-base-mpdocvqa | 125M | 0.4538 | 51.9426 |
| T5 base | rubentito/t5-base-mpdocvqa | 223M | 0.5050 | 0.0000 |
| Hi-VT5 | rubentito/hivt5-base-mpdocvqa | 316M | 0.6201 | 79.23 |
Citation Information
@article{tito2022hierarchical,
title={Hierarchical multimodal transformers for Multi-Page DocVQA},
author={Tito, Rub{\`e}n and Karatzas, Dimosthenis and Valveny, Ernest},
journal={arXiv preprint arXiv:2212.05935},
year={2022}
}
- Downloads last month
- 17