GIT (short for GenerativeImage2Text) model, base-sized version. It was introduced in the paper GIT: A Generative Image-to-text Transformer for Vision and Language by Wang et al. and first released in this repository. Disclaimer: The team releasing GIT did not write a model card for this model so this model card has been written by the Hugging Face team. GIT is a Transformer decoder conditioned on both CLIP image tokens and text tokens. The model is trained using "teacher forcing" on a lot of (image, text) pairs. The goal for the model is simply to predict the next text token, giving the image tokens and previous text tokens. The model has full access to (i.e. a bidirectional attention mask…
Open-weight model · Image to text
donut-boletas-peru
by André Edgardo Saras Rivera eng-aesr/donut-boletas-peru
donut-boletas-peru is an open-weight model for image to text from André Edgardo Saras Rivera, released under MIT License. It has 201M parameters. At 16-bit it needs about 0.5 GB of GPU memory, which fits on 1x MI300X from $1.85 an hour, at the lowest prices in the SAVRN Index. It draws 15 downloads a month.
Modelo experimental de extracción estructurada, sin OCR explícito, para imágenes de boletas peruanas. Es una adaptación de bajo recurso de naver-clova-ix/donut-base-finetuned-cord-v2, no un modelo entrenado desde cero.
Runs On
What it takes to serve donut-boletas-peru (201M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.
| Precision | Weights | Memory needed | Cheapest setup | Per hour | Also fits |
|---|---|---|---|---|---|
| 16-bit | 0.4 GB | 0.5 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
| 8-bit | 0.2 GB | 0.2 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
| 4-bit | 0.1 GB | 0.1 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Oct 18, 2026.
donut-boletas-peru on every accelerator the SAVRN Index prices, at every precision
Model Card
By André Edgardo Saras Rivera, published under mit, revision 48b72fe9d5a6.
Modelo experimental de extracción estructurada, sin OCR explícito, para imágenes de boletas peruanas. Es una adaptación de bajo recurso de naver-clova-ix/donut-base-finetuned-cord-v2, no un modelo entrenado desde cero. El modelo recibe una imagen completa y genera una representación que DonutProcessor.token2json convierte al siguiente esquema: Este checkpoint está pensado para investigación, demostraciones y prototipos supervisados sobre boletas impresas peruanas en español. Puede servir como punto de partida para nuevas evaluaciones o fine-tuning con datos propios. No debe utilizarse sin revisión humana para contabilidad, tributación, auditoría, pagos, cumplimiento normativo ni otras…
Read André Edgardo Saras Rivera's full model card
Donut para boletas peruanas
Modelo experimental de extracción estructurada, sin OCR explícito, para imágenes de boletas peruanas. Es una adaptación de bajo recurso de naver-clova-ix/donut-base-finetuned-cord-v2, no un modelo entrenado desde cero.
El modelo recibe una imagen completa y genera una representación que DonutProcessor.token2json convierte al siguiente esquema:
{
"empresa": "",
"ruc": "",
"fecha": "",
"nro_comprobante": "",
"menu": [
{
"nm": "",
"price": ""
}
],
"sub_total": "",
"igv": "",
"total": ""
}
Uso previsto
Este checkpoint está pensado para investigación, demostraciones y prototipos supervisados sobre boletas impresas peruanas en español. Puede servir como punto de partida para nuevas evaluaciones o fine-tuning con datos propios.
No debe utilizarse sin revisión humana para contabilidad, tributación, auditoría, pagos, cumplimiento normativo ni otras decisiones de alto impacto. Tampoco es un extractor universal de comprobantes: no fue validado para facturas, documentos manuscritos, documentos de otros países o imágenes fuera del dominio de entrenamiento.
Uso con Transformers
El checkpoint fue exportado con transformers==5.12.1 y se verificó localmente con transformers==5.15.0. Se recomienda cargar el modelo directamente en lugar de usar pipeline, porque requiere el prompt de tarea específico.
pip install "transformers==5.15.0" "torch>=2.4,<3" "pillow>=10"
from PIL import Image
import torch
from transformers import DonutProcessor, VisionEncoderDecoderModel
model_id = "eng-aesr/donut-boletas-peru"
task_prompt = "<s_receipt_peru>"
processor = DonutProcessor.from_pretrained(model_id)
model = VisionEncoderDecoderModel.from_pretrained(model_id)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device).eval()
image = Image.open("boleta.jpg").convert("RGB")
pixel_values = processor(image, return_tensors="pt").pixel_values.to(device)
decoder_input_ids = processor.tokenizer(
task_prompt,
add_special_tokens=False,
return_tensors="pt",
).input_ids.to(device)
generation_config = model.generation_config
generation_config.max_length = 768
generation_config.num_beams = 1
generation_config.pad_token_id = processor.tokenizer.pad_token_id
generation_config.eos_token_id = processor.tokenizer.eos_token_id
unk_token_id = processor.tokenizer.unk_token_id
bad_words_ids = [[unk_token_id]] if unk_token_id is not None else None
with torch.inference_mode():
output_ids = model.generate(
pixel_values,
decoder_input_ids=decoder_input_ids,
generation_config=generation_config,
bad_words_ids=bad_words_ids,
)
sequence = processor.batch_decode(output_ids, skip_special_tokens=False)[0]
for token in (
task_prompt,
processor.tokenizer.eos_token,
processor.tokenizer.pad_token,
):
if token:
sequence = sequence.replace(token, "")
result = processor.token2json(sequence.strip())
print(result)
Detalles del modelo
| Propiedad | Valor |
|---|---|
| Arquitectura | VisionEncoderDecoderModel (encoder Donut-Swin + decoder mBART) |
| Checkpoint base inmediato | naver-clova-ix/donut-base-finetuned-cord-v2 |
| Parámetros | 201,133,176 |
| Prompt de tarea | <s_receipt_peru> |
| Resolución del procesador | 1280 × 960 píxeles |
| Longitud máxima de generación | 768 tokens |
| Formato de pesos | SafeTensors |
| SHA-256 de los pesos | 27330e48fda6bf3f4ac117b28afc2ae354a039dbae179eb29bfc72b829ea960a |
Datos y entrenamiento
La adaptación utilizó un dataset privado de 140 boletas peruanas anotadas. El dataset y sus imágenes no se distribuyen con este modelo.
El checkpoint base inmediato ya había sido ajustado sobre CORD v2 por sus autores upstream. La etapa descrita aquí corresponde únicamente a la adaptación posterior al dominio peruano.
- Entrenamiento: 100 documentos originales. Se aplicaron tres variantes visuales suaves únicamente a este split (
blur,noiseyrotate), dando 400 registros de entrenamiento pero conservando 100 fuentes independientes. - Validación: 20 documentos reales, sin augmentation; se usaron para seleccionar el checkpoint.
- Test: 20 documentos reales, sin augmentation y sin uso durante la selección.
- Split: por identificador de documento (
source_id), no por empresa o plantilla visual.
Configuración principal de fine-tuning:
| Hiperparámetro | Valor |
|---|---|
| Learning rate | 1e-5 |
| Batch size por dispositivo | 2 |
| Gradient accumulation | 1 |
| Gradient clipping | 1.0 |
| Épocas máximas | 30 |
| Épocas ejecutadas | 10 |
| Early stopping | paciencia 4 |
| Seed | 2022 |
| Selección | menor eval_loss |
El mejor checkpoint fue el step 1200 (época 6), con eval_loss = 1.1445. La ejecución usó Python 3.12.13 y Transformers 5.12.1.
Evaluación
Las métricas se calcularon una sola vez sobre el test privado congelado de 20 documentos. Por el tamaño del test, cada error equivale a 5 puntos porcentuales; los resultados se presentan con conteo y porcentaje.
| Métrica | Resultado |
|---|---|
| JSON parseable | 15/20 (75.0%) |
| Ocho claves de nivel superior presentes | 10/20 (50.0%) |
| Esquema estricto válido (claves y tipos) | 4/20 (20.0%) |
| Normalized edit distance promedio | 0.4297 |
total exacto |
14/20 (70.0%) |
sub_total exacto |
10/20 (50.0%) |
fecha exacta |
9/20 (45.0%) |
ruc exacto |
8/20 (40.0%) |
igv exacto |
8/20 (40.0%) |
nro_comprobante exacto |
5/20 (25.0%) |
empresa exacta |
4/20 (20.0%) |
empresa Token-F1 promedio |
0.3229 |
| Cantidad de ítems correcta | 10.0% |
| Precio de ítems correcto | 16.7% |
| Nombre de ítems Token-F1 promedio | 0.1004 |
| Menú exacto | 0/20 (0.0%) |
Estos números describen este test concreto y no deben interpretarse como una estimación robusta del rendimiento sobre todas las boletas peruanas. No se calcularon intervalos de confianza.
Esquema estricto válido es una auditoría posterior de claves y tipos sobre las mismas predicciones guardadas. El evaluador original solo comprobaba la presencia de las ocho claves. Además, las métricas registradas de menu están sesgadas a la baja porque el evaluador original trataba como lista vacía el objeto que token2json produce para algunos menús de un solo ítem. Se conservan aquí por trazabilidad; no se publican métricas corregidas hasta repetir formalmente la evaluación.
Limitaciones y riesgos
- El dataset es pequeño y puede no representar la diversidad de comercios, impresoras, cámaras, iluminación y diseños presentes en Perú.
- El split evita duplicar el mismo documento entre conjuntos, pero no garantiza separación por empresa o plantilla; puede existir similitud visual entre splits.
- El modelo produce una salida no parseable en 25% del test. Solo 50% incluye las ocho claves de nivel superior y 20% satisface la auditoría estricta de claves y tipos.
- La extracción de listas es especialmente débil: el menú exacto fue 0% en el test registrado.
- Cuando hay un solo ítem,
menupuede generarse como un objeto en vez de una lista. Los consumidores deben preservar la salida cruda, validar tipos y tratar esta normalización explícitamente. - Puede confundir total, subtotal e IGV; copiar texto incorrectamente; omitir campos; o generar valores que no aparecen en la imagen.
- No devuelve una probabilidad calibrada que permita aceptar automáticamente una predicción.
- Los documentos pueden contener identificadores comerciales o personales. Aunque el dataset no se publica, un modelo generativo puede memorizar fragmentos; no debe asumirse que sus salidas están libres de información sensible.
Toda salida debe validarse estructuralmente y contrastarse con la imagen original antes de utilizarla.
Licencia y atribución
El checkpoint base se publica con licencia MIT. Esta adaptación se distribuye bajo la misma licencia. La licencia del modelo no concede derechos sobre las imágenes o documentos que cada usuario procese.
DONUT: OCR-free Document Understanding Transformer fue presentado en:
@article{kim2021donut,
title={OCR-free Document Understanding Transformer},
author={Kim, Geewook and Hong, Teakgyu and Yim, Moonbin and Park, Jinyoung and Yim, Jinyeong and Hwang, Wonseok and Yun, Sangdoo and Han, Dongyoon and Park, Seunghyun},
journal={arXiv preprint arXiv:2111.15664},
year={2021}
}
Contacto
Responsable del repositorio: eng-aesr.
Configuration
- Architecture
- VisionEncoderDecoderModel
- Model type
- vision-encoder-decoder
Identity and Version
- Repository
- eng-aesr/donut-boletas-peru
- Publisher
- André Edgardo Saras Rivera
- Task
- Image to text
- Modality
- Image and text
- Library
- transformers
- Parameters
- 201M parameters
- Languages
- es
- Revision
- 48b72fe9d5a6c46090b62e17cec01a0395939e1a
- First published
- 2026-08-17
- Last updated
- 2026-09-20
Files and Weights
9 files, 810.2 MB in total. The weights are 1 file totalling 806.2 MB in safetensors.
Every file
| File | Type | Size | SHA-256 |
|---|---|---|---|
| model.safetensors | Weights | 806.2 MB | 27330e48fda6 |
| config.json | Configuration | 3.5 KB | — |
| generation_config.json | Configuration | 1.0 KB | — |
| processor_config.json | Configuration | 513 B | — |
| LICENSE | Documentation | 1.1 KB | — |
| README.md | Documentation | 9.8 KB | — |
| .gitattributes | Repository | 1.5 KB | — |
| tokenizer.json | Tokenizer | 4.0 MB | — |
| tokenizer_config.json | Tokenizer | 702 B | — |
License and Download
- License
- mit
- Access
- Open weights, no gate
- Download size
- 806.2 MB
Released by André Edgardo Saras Rivera through its official repository on Hugging Face. Read the license.
Built From
- Derived from naver-clova-ix/donut-base-finetuned-cord-v2
- Described by arXiv:2111.15664
Evaluations
Each result is shown as reported, with the conditions its reporter stated. None is a SAVRN measurement. A comparison lines two results up only when their configuration, unit and setup are all stated and identical.
| Benchmark | Conditions | Result | Reported by | Revision | Date |
|---|---|---|---|---|---|
| Test privado de boletas peruanas | Task Extracción estructurada de boletasMetric Esquema estricto válidoComparison conditions not established | 20 | eng-aesr Publisher reported |
Evaluated revision not stated | — |
| Test privado de boletas peruanas | Task Extracción estructurada de boletasMetric Fecha exact matchComparison conditions not established | 45 | eng-aesr Publisher reported |
Evaluated revision not stated | — |
| Test privado de boletas peruanas | Task Extracción estructurada de boletasMetric Ocho claves de nivel superior presentesComparison conditions not established | 50 | eng-aesr Publisher reported |
Evaluated revision not stated | — |
| Test privado de boletas peruanas | Task Extracción estructurada de boletasMetric RUC exact matchComparison conditions not established | 40 | eng-aesr Publisher reported |
Evaluated revision not stated | — |
| Test privado de boletas peruanas | Task Extracción estructurada de boletasMetric Subtotal exact matchComparison conditions not established | 50 | eng-aesr Publisher reported |
Evaluated revision not stated | — |
| Test privado de boletas peruanas | Task Extracción estructurada de boletasMetric Total exact matchComparison conditions not established | 70 | eng-aesr Publisher reported |
Evaluated revision not stated | — |
Memory Requirements
| Precision | Weights in memory |
|---|---|
| As published | 806.2 MB |
| 16-bit | 0.4 GB |
| 8-bit | 0.2 GB |
| 4-bit | 0.1 GB |
Weights only, from the published parameter count; the key-value cache and runtime add to this.
Questions About donut-boletas-peru
How much GPU memory does donut-boletas-peru need?
About 0.5 GB at 16-bit and 0.1 GB at 4-bit: the weights (201M parameters) plus a working margin. A long context needs more.
What is the cheapest GPU to run donut-boletas-peru on?
At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.
Can I use donut-boletas-peru commercially?
Yes. donut-boletas-peru is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.
Similar Models
MGP-STR base-sized model is trained on MJSynth and SynthText. It was introduced in the paper Multi-Granularity Prediction for Scene Text Recognition and first released in this repository. MGP-STR is pure vision STR model, consisting of ViT and specially designed A^3 modules. The ViT module was initialized from the weights of DeiT-base, except the patch embedding model, due to the inconsistent input size. Images (32x128) are presented to the model as a sequence of fixed-size patches (resolution 4x4), which are linearly embedded. One also adds absolute position embeddings before feeding the sequence to the layers of the ViT module. Next, A^3 module selects a meaningful combination from the…
This model is the pretrained version of Pix2Struct, use this model for fine-tuning purposes only. Pix2Struct is an image encoder - text decoder model that is trained on image-text pairs for various tasks, including image captionning and visual question answering. The full list of available models can be found on the Table 1 of the paper: The abstract of the model states that: forms. Perhaps due to this diversity, previous work has typically relied on domainspecific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks…
TrOCR model fine-tuned on the SROIE dataset. It was introduced in the paper TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models by Li et al. and first released in this repository. Disclaimer: The team releasing TrOCR did not write a model card for this model so this model card has been written by the Hugging Face team. The TrOCR model is an encoder-decoder model, consisting of an image Transformer as encoder, and a text Transformer as decoder. The image encoder was initialized from the weights of BEiT, while the text decoder was initialized from the weights of RoBERTa. Images are presented to the model as a sequence of fixed-size patches (resolution 16x16), which…
TrOCR model fine-tuned on the IAM dataset. It was introduced in the paper TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models by Li et al. and first released in this repository. Disclaimer: The team releasing TrOCR did not write a model card for this model so this model card has been written by the Hugging Face team. The TrOCR model is an encoder-decoder model, consisting of an image Transformer as encoder, and a text Transformer as decoder. The image encoder was initialized from the weights of BEiT, while the text decoder was initialized from the weights of RoBERTa. Images are presented to the model as a sequence of fixed-size patches (resolution 16x16), which…
TrOCR model fine-tuned on the SROIE dataset. It was introduced in the paper TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models by Li et al. and first released in this repository. The TrOCR model is an encoder-decoder model, consisting of an image Transformer as encoder, and a text Transformer as decoder. The image encoder was initialized from the weights of DeiT, while the text decoder was initialized from the weights of UniLM. Images are presented to the model as a sequence of fixed-size patches (resolution 16x16), which are linearly embedded. One also adds absolute position embeddings before feeding the sequence to the layers of the Transformer encoder. Next…