Instructions to use PiotrSty/trocr-pl-mixed-aug-light-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PiotrSty/trocr-pl-mixed-aug-light-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="PiotrSty/trocr-pl-mixed-aug-light-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("PiotrSty/trocr-pl-mixed-aug-light-v1") model = AutoModelForMultimodalLM.from_pretrained("PiotrSty/trocr-pl-mixed-aug-light-v1", device_map="auto") - PEFT
How to use PiotrSty/trocr-pl-mixed-aug-light-v1 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PiotrSty/trocr-pl-mixed-aug-light-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PiotrSty/trocr-pl-mixed-aug-light-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PiotrSty/trocr-pl-mixed-aug-light-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/PiotrSty/trocr-pl-mixed-aug-light-v1
- SGLang
How to use PiotrSty/trocr-pl-mixed-aug-light-v1 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 "PiotrSty/trocr-pl-mixed-aug-light-v1" \ --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": "PiotrSty/trocr-pl-mixed-aug-light-v1", "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 "PiotrSty/trocr-pl-mixed-aug-light-v1" \ --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": "PiotrSty/trocr-pl-mixed-aug-light-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use PiotrSty/trocr-pl-mixed-aug-light-v1 with Docker Model Runner:
docker model run hf.co/PiotrSty/trocr-pl-mixed-aug-light-v1
PiotrSty/trocr-pl-mixed-aug-light-v1 (experimental)
Fine-tune of PiotrSty/trocr-pl-base on synthetic Polish print + real EHRI typewritten Polish lines + 3× light-augmented EHRI train lines. run 6 used medium augmentations (5×) which improved typewriter but regressed print (5.36% → 7.37%). This run uses light strength (blur+noise only, no gamma/JPEG/contrast) with 3× copies to test if gentler augmentations avoid the print regression while keeping the typewriter gain.
Training
- Base: PiotrSty/trocr-pl-base
- Method: QLoRA on decoder attention (q/k/v/out_proj), rank 16, alpha 32
- Train: 2000 synthetic + 349 real EHRI + 698 light-augmented EHRI = 3047 lines
- Val: 38 EHRI lines (held-out doc ZIH3010905, not augmented)
- Epochs: 15, batch 8, lr 1e-4, T4 x2
- Best checkpoint: /kaggle/working/trocr-pl-run7/checkpoint-1410 (val CER 0.2777, WER 0.6456)
- Document-level split, no line leakage. Light augmentations only on train.
Evaluation on frozen held-out sets
| Model | EHRI test (81, typewriter) | real-lines-v1 (75, print) |
|---|---|---|
| trocr-pl-base (run2) | CER 47.30% / WER 90.82% | CER 11.11% / WER 35.84% |
| trocr-pl-mixed-v3 (run5, 30 ep) | CER 29.74% / WER 74.96% | CER 5.36% / WER 22.88% |
| trocr-pl-mixed-aug-v1 (run6, 15 ep + medium aug 5×) | CER 27.30% / WER 69.83% | CER 7.37% / WER 26.72% |
| trocr-pl-mixed-aug-light-v1 (run7, 15 ep + light aug 3×) | (fill from eval cell) | (fill from eval cell) |
Limitations
- Line recognizer only; page segmentation on faded typewriter is unreliable.
- Augmentations are synthetic; real data diversity still matters.
- Do NOT use as drop-in replacement without your own eval.
Provenance
See run.json, selection.json, best_metrics.json in this repo. Source: https://github.com/PiotrStyla/OCR_engine (commit 9911c81) EHRI dataset: https://huggingface.co/datasets/PiotrSty/ehri-pl-lines
- Downloads last month
- 15