cli-workflows
Generate safe, correct train.py, validate.py, inference.py, and torchrun/distributed commands for timm reference scripts.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- cli-workflows
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Generate safe, correct train.py, validate.py, inference.py, and torchrun/distributed commands for timm reference scripts.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/distributed-training.md3.9 KB
- 参考文档references/train-validate-inference.md8.5 KB
- 参考文档references/troubleshooting.md5.8 KB
- 脚本scripts/timm_cli_command_builder.py6.6 KB
03 SKILL.md 正文
timm CLI Workflows
Use this sub-skill when the user needs commands for timm's repository-root training, validation, or inference scripts, or when adapting examples into reproducible shell commands. Keep this focused on command construction and operational caveats; route API-level model/data/training internals to the model-library, data, or training sub-skills, and route benchmark/result-table analysis to benchmarking-and-results.
Routing Checklist
- Use
references/train-validate-inference.mdfor command shapes, dataset layout expectations, config files, output flags, CPU/debug variants, pretrained/checkpoint behavior, and NaFlex flags. - Use
references/distributed-training.mdfortorchrun,distributed_train.shequivalence, DDP environment assumptions, local rank handling, and multi-GPU command patterns. - Use
references/troubleshooting.mdwhen a command fails because scripts are missing, the dataset split path is wrong, CUDA is selected on a CPU host, downloads fail, result/class-map files fail, DDP hangs, NaFlex flags mismatch the model, or validation OOMs. - Use
scripts/timm_cli_command_builder.pyto print dry commands without importing timm, running training, or checking local files.
High-Value Defaults
- Prefer explicit
--data-dir,--model,--batch-size,--workers, and--devicerather than relying on script defaults. - For CPU/debug commands, set
--device cpu, small--batch-size, low--workers, and short training controls such as--epochs 1,--val-interval 1, or--no-augvia extra args. - For CUDA commands, add
--amponly when the target host has a supported accelerator and the requested dtype is valid for the workflow. - For training datasets, point
--data-dirat the base folder containing train and validation splits; for validation/inference, point it at the validation/image split folder unless a non-ImageFolder dataset string changes split handling. - If the user installed timm from pip only, explain that the root scripts may not be installed; they need a checkout copy of
train.py,validate.py,inference.py, or equivalent copied scripts.
Bundled Command Builder
python scripts/timm_cli_command_builder.py train \
--data-dir /data/imagenet --model resnet50 --batch-size 32 --device cpu \
-- --epochs 1 --no-aug
The builder prints a shell-quoted command. It is intentionally dry: it never imports timm, never validates model names, never probes devices, and never opens datasets. Put advanced script flags after --, or pass repeated --extra-arg=value tokens when a wrapper cannot use passthrough arguments.
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).