Instructions to use TomasFAV/Pix2StructCzechInvoiceV0123 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TomasFAV/Pix2StructCzechInvoiceV0123 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TomasFAV/Pix2StructCzechInvoiceV0123")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("TomasFAV/Pix2StructCzechInvoiceV0123") model = AutoModelForImageTextToText.from_pretrained("TomasFAV/Pix2StructCzechInvoiceV0123") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TomasFAV/Pix2StructCzechInvoiceV0123 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TomasFAV/Pix2StructCzechInvoiceV0123" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TomasFAV/Pix2StructCzechInvoiceV0123", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TomasFAV/Pix2StructCzechInvoiceV0123
- SGLang
How to use TomasFAV/Pix2StructCzechInvoiceV0123 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TomasFAV/Pix2StructCzechInvoiceV0123" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TomasFAV/Pix2StructCzechInvoiceV0123", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TomasFAV/Pix2StructCzechInvoiceV0123" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TomasFAV/Pix2StructCzechInvoiceV0123", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TomasFAV/Pix2StructCzechInvoiceV0123 with Docker Model Runner:
docker model run hf.co/TomasFAV/Pix2StructCzechInvoiceV0123
# Load model directly
from transformers import AutoProcessor, AutoModelForImageTextToText
processor = AutoProcessor.from_pretrained("TomasFAV/Pix2StructCzechInvoiceV0123")
model = AutoModelForImageTextToText.from_pretrained("TomasFAV/Pix2StructCzechInvoiceV0123")Pix2StructCzechInvoice (V3 – Full Pipeline with Real Data Fine-Tuning)
This model is a fine-tuned version of google/pix2struct-docvqa-base for structured information extraction from Czech invoices.
It achieves the following results on the evaluation set:
- Loss: 0.1542
- F1: 0.8404
Model description
Pix2StructCzechInvoice (V3) is the final generative model in the experimental pipeline.
Unlike token classification approaches, this model:
- processes full document images
- generates structured outputs as text sequences
It extracts key invoice fields such as:
- supplier
- customer
- invoice number
- bank details
- totals
- dates
By combining synthetic, hybrid, and real data, this version significantly improves both performance and stability.
Training data
The dataset used in this stage combines:
- Synthetic template-based invoices (V0)
- Synthetic invoices with randomized layouts (V1)
- Hybrid invoices with real layouts and synthetic content (V2)
- Real annotated invoices
Real data fine-tuning
The final stage introduces:
- real invoice images
- realistic visual noise and distortions
- natural language variability
- real formatting inconsistencies
This allows the model to:
- better align generated outputs with real-world distributions
- improve robustness of sequence generation
- reduce hallucinations and formatting errors
Role in the pipeline
This model corresponds to:
V3 – Full pipeline (synthetic + hybrid + real data fine-tuning)
It represents:
- the final generative model
- the best-performing Pix2Struct variant
- an end-to-end extraction approach
Intended uses
- End-to-end invoice information extraction from images
- Document VQA and generative document understanding
- OCR-free document processing pipelines
- Research in generative vs structured extraction approaches
Limitations
- Output format may still be inconsistent
- Sensitive to decoding strategy and prompt structure
- Less interpretable than token classification models
- Requires post-processing for structured outputs
- Computationally more expensive
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0001
- train_batch_size: 8
- eval_batch_size: 1
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine_with_restarts
- lr_scheduler_warmup_steps: 0.1
- num_epochs: 10
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss | F1 |
|---|---|---|---|---|
| 0.3277 | 1.0 | 23 | 0.1958 | 0.7239 |
| 0.2366 | 2.0 | 46 | 0.1446 | 0.8037 |
| 0.1780 | 3.0 | 69 | 0.1247 | 0.8060 |
| 0.1153 | 4.0 | 92 | 0.1178 | 0.8316 |
| 0.0895 | 5.0 | 115 | 0.1279 | 0.8312 |
| 0.0774 | 6.0 | 138 | 0.1542 | 0.8404 |
| 0.0766 | 7.0 | 161 | 0.1530 | 0.7972 |
| 0.0697 | 8.0 | 184 | 0.1385 | 0.8372 |
| 0.0804 | 9.0 | 207 | 0.1433 | 0.7963 |
| 0.0664 | 10.0 | 230 | 0.1614 | 0.7991 |
Framework versions
- Transformers 5.0.0
- PyTorch 2.10.0+cu128
- Datasets 4.0.0
- Tokenizers 0.22.2
- Downloads last month
- 8
Model tree for TomasFAV/Pix2StructCzechInvoiceV0123
Base model
google/pix2struct-docvqa-base
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TomasFAV/Pix2StructCzechInvoiceV0123")