File size: 1,548 Bytes
2a2ed12
 
b5c9a1e
 
 
 
 
 
 
 
2a2ed12
b5c9a1e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: gpl-3.0
tags:
- DocVQA
- Document Question Answering
- Document Visual Question Answering
datasets:
- MP-DocVQA
language:
- en
---

# T5 base fine-tuned on MP-DocVQA

This is [pretrained](https://huggingface.co/t5-base) T5 base and fine-tuned on Multipage DocVQA (MP-DocVQA) dataset.


This model was used as a baseline in [Hierarchical multimodal transformers for Multi-Page DocVQA](https://arxiv.org/pdf/2212.05935.pdf).
- Results on the MP-DocVQA dataset are reported in Table 2.
- Training hyperparameters can be found in Table 8 of Appendix D.
- 

## How to use

Here is how to use this model to get the features of a given text in PyTorch:

```python
import torch
from transformers import T5Tokenizer, T5ForConditionalGeneration

tokenizer = LongformerTokenizerFast.from_pretrained("rubentito/t5-base-mpdocvqa")
model = LongformerForQuestionAnswering.from_pretrained("rubentito/t5-base-mpdocvqa")

context = "Huggingface has democratized NLP. Huge thanks to Huggingface for this."
question = "What has Huggingface done?"
input_text = "question: {:s}  context: {:s}".format(question, context)

encoding = tokenizer(input_text, return_tensors="pt")
output = self.model.generate(**encoding)
answer = tokenizer.decode(output['sequences'], skip_special_tokens=True)
```

## BibTeX entry

```tex
@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}
}
```