Closed calvinzhan closed 1 year ago
The models you downloaded from huggingface are just pretraining weights. To get satisfying results on downstream tasks, such as QA and token classification, you need to fine-tune the weights on a specific dataset.
test_ernie_qa.py
is just a showcase of how to use the codes on a QA task.
allanj posts a complete pipeline of fine-tuning on DocVQA that I strongly recommend reading. You can replace the tokenizer and model with ERNIE-Layout in this repo and train a model for your own task.
I tried an actual image sample from ernie-layout official site with test_ernie_qa.py, but couldn't get good result.
What I did was:
The start_max is bigger than end_max, so that answer is empty.
The code I changed for test_ernie_qa.py is listed below.