data-pipelines
Build timm data configs, datasets, transforms, loaders, ImageNet metadata, mixup/random erasing, and NaFlex data pipelines for train, eval, and inference.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-pipelines
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build timm data configs, datasets, transforms, loaders, ImageNet metadata, mixup/random erasing, and NaFlex data pipelines for train, eval, and inference.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/data-api.md6.6 KB
- 参考文档references/transform-loader-recipes.md6.5 KB
- 参考文档references/troubleshooting.md6.7 KB
- 脚本scripts/data_config_probe.py3.5 KB
03 SKILL.md 正文
timm Data Pipelines
Use this sub-skill when a task needs timm data input handling rather than model discovery or optimizer/training-loop design. It covers create_dataset, ImageDataset, IterableImageDataset, resolve_data_config, create_transform, create_loader, ImageNet metadata helpers, mixup/random erasing, prefetcher/device/dtype choices, and NaFlex loader settings.
Route by Task
- Model-aligned inference/eval transforms: start with
resolve_data_config(model=model)orresolve_data_config(pretrained_cfg=...), then pass the result intocreate_transform. Seereferences/data-api.mdandreferences/transform-loader-recipes.md. - Folder, tar, TorchVision, HF, TFDS, or WebDataset inputs: use
create_datasetwith a reader-stylename,root,split,search_split, and optionalclass_map. Seereferences/data-api.md. - Training and validation loaders: use
create_loaderto attach transforms to a dataset and create a PyTorchDataLoaderorPrefetchLoader. Setdevice=torch.device('cpu')oruse_prefetcher=Falseon CPU-only systems. Seereferences/transform-loader-recipes.md. - Augmentation policy choices: configure train-time
create_transform/create_loaderargs such asscale,ratio,hflip,color_jitter,auto_augment,re_prob,re_mode, andre_count. UseMixuporFastCollateMixupwhen labels need soft targets. - NaFlex variable-resolution pipelines: use
create_transform(..., naflex=True, patch_size=..., max_seq_len=..., patchify=...)for transform-only work orcreate_naflex_loaderfor loader-managed patchified batches. Seereferences/transform-loader-recipes.md. - Class names and ImageNet subsets: use
ImageNetInfoandinfer_imagenet_subsetwhen mapping ImageNet indices, synsets, or model class counts to labels. Seereferences/data-api.md.
Common Workflow
- Create or inspect the model in the model-library sub-skill when model selection is in scope.
- Resolve data settings with
resolve_data_config(args=overrides, model=model). - Build an eval/inference transform with
create_transform(**data_config)or a training transform withcreate_transform(is_training=True, **data_config, ...). - Create the dataset with
create_dataset(...)only when files or dataset services are needed. - Create the loader with
create_loader(dataset, **data_config, batch_size=..., is_training=...), explicitly decidingdevice,img_dtype, anduse_prefetcher.
Bundled Probe
Run scripts/data_config_probe.py to inspect a model's resolved data config and summarize eval/train transform objects without requiring a dataset. The script prints JSON-safe output and is useful before wiring loaders.
Cross-Links
- Use the model-library sub-skill for selecting model names, pretrained configs, and NaFlex-compatible model creation.
- Use the training-workflows sub-skill for optimizer, loss, AMP, distributed training, and how mixup labels affect losses.
- Use the cli-workflows sub-skill for full
train.py,validate.py, orinference.pycommand construction.
Troubleshooting First Stops
- CPU-only loader fails: set
device=torch.device('cpu')whenuse_prefetcher=True, or disable the prefetcher. - Accuracy is unexpectedly poor: re-check
input_size,interpolation,mean,std,crop_pct, andcrop_modefrom the model's pretrained config. - Dataset cannot find classes or split: check
root,split,search_split, folder names, andclass_mapfile format. - NaFlex fails shape assertions: confirm both model and loader/transform are NaFlex-compatible and agree on
patch_size,max_seq_len, andpatchify_channels_last.
See references/troubleshooting.md for detailed failure modes.
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).