This is
pretrained T5 base fine-tuned on Multipage DocVQA (MP-DocVQA) dataset.
1import torch
2from transformers import T5Tokenizer, T5ForConditionalGeneration
3
4tokenizer = LongformerTokenizerFast.from_pretrained("rubentito/t5-base-mpdocvqa")
5model = LongformerForQuestionAnswering.from_pretrained("rubentito/t5-base-mpdocvqa")
6
7context = "Huggingface has democratized NLP. Huge thanks to Huggingface for this."
8question = "What has Huggingface done?"
9input_text = "question: {:s} context: {:s}".format(question, context)
10
11encoding = tokenizer(input_text, return_tensors="pt")
12output = self.model.generate(**encoding)
13answer = tokenizer.decode(output['sequences'], skip_special_tokens=True)
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.
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.
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.
1@article{tito2022hierarchical,
2 title={Hierarchical multimodal transformers for Multi-Page DocVQA},
3 author={Tito, Rub{\`e}n and Karatzas, Dimosthenis and Valveny, Ernest},
4 journal={arXiv preprint arXiv:2212.05935},
5 year={2022}
6}