datasets-training-and-evaluation
Use docTR datasets, label formats, safe dataset validation, training/evaluation reference scripts, metrics, transforms, DataLoader, synthetic generators, and DDP/GPU caveats.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- datasets-training-and-evaluation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use docTR datasets, label formats, safe dataset validation, training/evaluation reference scripts, metrics, transforms, DataLoader, synthetic generators, and DDP/GPU caveats.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md11.6 KB
- 参考文档references/evaluation-and-training.md10.1 KB
- 参考文档references/training-scripts.md10.0 KB
- 参考文档references/troubleshooting.md9.6 KB
- 脚本scripts/validate_doctr_labels.py20.1 KB
03 SKILL.md 正文
docTR datasets, training, and evaluation
Use this sub-skill when the user needs to prepare, validate, load, train with, or evaluate datasets for docTR detection, recognition, OCR/KIE-style detection, layout analysis, table structure recognition, character classification, or orientation classification.
Do not run full training, dataset downloads, latency benchmarks, or multi-GPU jobs by default. First validate local labels and run only cheap import/help/batch-smoke checks unless the user explicitly asks for the heavy run and accepts compute/network costs.
Route by user intent
- Custom or built-in dataset loading, JSON schema questions,
VOCABS,encode_string,decode_sequence,CharacterGenerator,WordGenerator, transforms, orDataLoader: read references/data-formats.md. - Choosing or adapting the reference training, evaluation, or latency scripts: read references/training-scripts.md.
- Designing a safe preflight, one-batch smoke, metric interpretation, or checkpoint/evaluation handoff: read references/evaluation-and-training.md.
- Label validation, shape/class mismatches, vocab failures, DDP/GPU errors, DataLoader collation, synthetic font issues, or metrics returning
None: read references/troubleshooting.md. - If the user asks how to load trained weights into OCR/KIE/table/layout inference, route to the sibling model/customization and core OCR/KIE skills after completing the training/evaluation handoff.
Safe local helper
Use the bundled validator before any custom-data training run:
python scripts/validate_doctr_labels.py --task detection --dataset-root DATASET_ROOT
python scripts/validate_doctr_labels.py --task recognition --dataset-root DATASET_ROOT --warn-spaces
python scripts/validate_doctr_labels.py --task layout --dataset-root DATASET_ROOT
python scripts/validate_doctr_labels.py --task table --dataset-root DATASET_ROOT
python scripts/validate_doctr_labels.py --task ocr --dataset-root DATASET_ROOT
The helper reads local JSON and checks local image existence only. It never trains, downloads, benchmarks, or imports heavyweight model code.
Operating guardrails
- Determine the task family first: detection, recognition, OCR/KIE-style detection, layout, table structure, character classification, or orientation classification.
- Validate dataset layout and JSON shape before invoking docTR dataset classes.
- For local training, require train and validation roots; for built-in training, use built-in dataset arguments instead of local paths. Do not mix local path and built-in dataset arguments for the same split.
- For recognition, confirm the vocabulary before training or evaluating. Default examples often use the French vocab; custom multilingual labels need a compatible
VOCABSentry or explicit model vocab. - For rotated geometry, keep the
use_polygons/--rotation/--eval-straightchoices consistent between dataset, training, and metrics. - For batching, pass the dataset
collate_fnto the framework DataLoader because targets have variable-size dictionaries, arrays, strings, or table structures. - For DDP, use
torchrun, let it setLOCAL_RANK, and choose a backend compatible with the visible hardware.ncclis CUDA-oriented; CPU or non-CUDA environments need a different backend or single-process execution.
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).