donut
Use Donut for OCR-free document understanding, checkpoint inference, fine-tuning, evaluation, and SynthDoG synthetic document generation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- donut
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use Donut for OCR-free document understanding, checkpoint inference, fine-tuning, evaluation, and SynthDoG synthetic document generation.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md6.5 KB
- 参考文档references/repo-provenance.md3.6 KB
- 参考文档references/repo-routing-metadata.json489 B
- 参考文档references/troubleshooting.md5.2 KB
- 参考文档references/workflow-map.md5.2 KB
- 脚本scripts/runtime_smoke.py6.5 KB
03 SKILL.md 正文
Donut
Use this repo skill when the task involves NAVER/ClovaAI Donut: OCR-free document understanding with a Swin encoder and BART-like decoder, plus SynthDoG synthetic document generation. This skill is self-contained; do not reopen the original checkout for routine Donut usage.
Route by task
| User intent | Read or run |
|---|---|
| Load a Donut checkpoint, run one-image prediction, compare prompts, or start the Gradio demo | sub-skills/inference/SKILL.md |
| Fine-tune, validate dataset JSONL, evaluate a checkpoint, read metrics, or debug configs/checkpoints | sub-skills/training/SKILL.md |
| Generate synthetic document images, render SynthDoG configs, or adapt resources/fonts/corpora | sub-skills/synthdog/SKILL.md |
| Inspect public package APIs, signatures, token helpers, and object relationships | references/api-reference.md |
| Decide which bundled workflow helper or sub-skill owns a request | references/workflow-map.md |
| Diagnose install/import, Hugging Face, CUDA, Gradio, dataset, or SynthDoG dependency failures | references/troubleshooting.md |
| Check source baseline, commit, version, and refresh triggers | references/repo-provenance.md |
Fast start
- Install a Donut-capable Python environment. For inference only,
pip install donut-pythonplus a compatible PyTorch build is the starting point. Training needs CUDA-capable PyTorch. SynthDoG generation also needssynthtigerand its image/text dependencies. - Smoke-check the environment without the source repo:
python scripts/runtime_smoke.py python scripts/runtime_smoke.py --check all --require-cuda # when training and SynthDoG are in scope - Route to a sub-skill before giving detailed commands. Each sub-skill owns its own scripts and troubleshooting notes.
Core facts to preserve
- Package distribution:
donut-python; import module:donut. - Public exports include
DonutConfig,DonutModel,DonutDataset,JSONParseEvaluator,load_json, andsave_json. DonutModel.from_pretrained(...)loads local or Hugging Face checkpoints and requests the Donut repositories'officialrevision.DonutModel.inference(...)returns a dictionary with apredictionslist; parsed JSON is the default output.- Dataset rows use
file_nameplus a JSON-encodedground_truthstring containing eithergt_parseorgt_parses. - Training is GPU-oriented in the original scripts; do not promise CPU training equivalence.
- No model weights, datasets, or large SynthDoG assets are bundled in this skill. Users must provide checkpoints, images, datasets, and SynthDoG resources.
Bundled helpers
scripts/runtime_smoke.py: cross-workflow environment/API smoke check.sub-skills/inference/scripts/run_inference.py: single-image inference and prompt comparison.sub-skills/inference/scripts/launch_demo.py: Gradio demo launcher.sub-skills/training/scripts/train_donut.py: bundled CUDA-oriented trainer entry point.sub-skills/training/scripts/check_training_config.py: config and metadata validator.sub-skills/training/scripts/evaluate_dataset.py: local/HF dataset evaluation helper and validation-only mode.sub-skills/training/references/configs/: bundled CORD, DocVQA, RVL-CDIP, and TrainTicket config examples.sub-skills/synthdog/scripts/render_config.py: render bundled SynthDoG placeholder configs for external resources.sub-skills/synthdog/scripts/template.py: bundled SynthDoG template used bysynthtiger.
Boundaries
Use Donut for OCR-free document-image understanding, classification, extraction, visual QA, and synthetic-document pretraining data generation. Do not use this skill for generic PDF parsing, OCR engines, RAG chunking, non-document computer vision models, or unrelated Transformers training unless Donut APIs, checkpoints, config files, errors, or data formats are central to the request.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).