donut base finetuned docvqa

Providernaver-clova-ix
Categorydocument-question-answering
Licensemit
Downloads67.7K
Stars0

Overview

The Donut-base model finetuned for DocVQA represents a shift toward OCR-free document understanding. Unlike traditional pipelines that require a separate optical character recognition engine to extract text before processing, Donut maps image pixels directly to structured text sequences. This architecture significantly reduces pipeline latency and eliminates the cumulative error rate common in OCR-based workflows. For developers, this means a streamlined integration for visual question answering (VQA) tasks where the model interprets the spatial layout and textual content of a document simultaneously. It is particularly effective for automating data extraction from invoices, receipts, and forms where maintaining the visual context of the document is critical for accurate information retrieval.

Highlights

  • OCR-free architecture reduces pipeline complexity and latency
  • Direct image-to-text mapping for structured document analysis
  • Optimized for visual question answering on diverse documents
  • MIT licensed for flexible commercial and private integration

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("naver-clova-ix/donut-base-finetuned-docvqa")
tokenizer = AutoTokenizer.from_pretrained("naver-clova-ix/donut-base-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:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download naver-clova-ix/donut-base-finetuned-docvqa

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download naver-clova-ix/donut-base-finetuned-docvqa config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('naver-clova-ix/donut-base-finetuned-docvqa')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/naver-clova-ix/donut-base-finetuned-docvqa

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/naver-clova-ix/donut-base-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

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('naver-clova-ix/donut-base-finetuned-docvqa')
tokenizer = AutoTokenizer.from_pretrained('naver-clova-ix/donut-base-finetuned-docvqa')

Full Documentation

来源: HuggingFace

---
license: mit
pipeline_tag: document-question-answering
tags:

  • donut

  • image-to-text

  • vision

widget:
  • text: "What is the invoice number?"

src: "https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png"
  • text: "What is the purchase amount?"

src: "https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/contract.jpeg"
---

Donut (base-sized model, fine-tuned on DocVQA)

Donut model fine-tuned on DocVQA. It was introduced in the paper OCR-free Document Understanding Transformer by Geewok et al. and first released in this repository.

Disclaimer: The team releasing Donut did not write a model card for this model so this model card has been written by the Hugging Face team.

Model description

Donut consists of a vision encoder (Swin Transformer) and a text decoder (BART). Given an image, the encoder first encodes the image into a tensor of embeddings (of shape batch_size, seq_len, hidden_size), after which the decoder autoregressively generates text, conditioned on the encoding of the encoder.

!model image

Intended uses & limitations

This model is fine-tuned on DocVQA, a document visual question answering dataset.

We refer to the documentation which includes code examples.

BibTeX entry and citation info

bibtex
@article{DBLP:journals/corr/abs-2111-15664,
  author    = {Geewook Kim and
               Teakgyu Hong and
               Moonbin Yim and
               Jinyoung Park and
               Jinyeong Yim and
               Wonseok Hwang and
               Sangdoo Yun and
               Dongyoon Han and
               Seunghyun Park},
  title     = {Donut: Document Understanding Transformer without {OCR}},
  journal   = {CoRR},
  volume    = {abs/2111.15664},
  year      = {2021},
  url       = {https://arxiv.org/abs/2111.15664},
  eprinttype = {arXiv},
  eprint    = {2111.15664},
  timestamp = {Thu, 02 Dec 2021 10:50:44 +0100},
  biburl    = {https://dblp.org/rec/journals/corr/abs-2111-15664.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
Join our Telegram