loader-pipelines
Build, inspect, and troubleshoot FFCV Loader pipelines: ordering, decoders, native and torch transforms, custom Operation contracts, subsets, partial batches, distributed sampling, and training integration.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- loader-pipelines
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build, inspect, and troubleshoot FFCV Loader pipelines: ordering, decoders, native and torch transforms, custom Operation contracts, subsets, partial batches, distributed sampling, and training integration.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/custom-operations.md10.6 KB
- 参考文档references/image-pipelines.md8.7 KB
- 参考文档references/pipelines.md10.3 KB
- 参考文档references/training-integration.md8.9 KB
- 参考文档references/troubleshooting.md10.5 KB
03 SKILL.md 正文
FFCV loader pipelines
Use this sub-skill when a Researcher must construct or debug an FFCV
Loader, its per-field PipelineSpec, or the operations between a field
decoder and a training step. It owns traversal/order semantics, decoder-first
pipeline construction, state and preallocated-memory contracts, NumPy/JIT to
PyTorch/CPU/GPU boundaries, index-aware operations, filtering/subsets,
partial batches, and distributed/training integration.
Do not use it for dataset writing/field encoding or broad cache and throughput
tuning; hand those concerns to the writer or performance sub-skill. Keep the
pipeline's exact field names, target shapes/dtypes/devices, order, seed,
subset, and drop_last policy explicit before changing code.
Fast routing
- Identify the
.betonfields and desired outputs. Start with pipelines.md. - Choose explicit decoder and transform stages from image-pipelines.md
or the relevant field decoder. A decoder is first; put
ToTensorbefore any torch operation andToDevicebefore GPU-only work. - For a custom operation, read custom-operations.md
and validate its state, allocation, callable signature, partial-batch, and
optional
with_indicesbehavior. - Apply subset/order/distributed/drop-last decisions and then use training-integration.md for a bounded loop. Diagnose construction and runtime failures with troubleshooting.md.
Non-negotiable rules
- A missing pipeline entry gets the field's default decoder plus
ToTensor(); an explicitNonedisables that field. Do not confuse omitted with disabled. - A sequence is normalized into a
PipelineSpec; if its first operation is an instance of the field's decoder class, it is consumed as the decoder. APipelineSpec(source=..., decoder=..., transforms=...)is useful for explicit sources and shared operation references. - Native NumPy operations must remain before
ToTensor/ToDevice. Atorch.nn.Moduleis wrapped automatically asModuleWrapper, but it is not a JIT/Numba operation; place it after tensor conversion and on the intended device.ToTorchImagechanges HWC batches to BCHW. - Every non-default operation must accurately advance
Stateand return an allocation query when it writes a new output. Functions must accept the arguments the generated graph supplies, return the effective batch, and never assumebatch_sizesamples whendrop_last=False. with_indices=Truereceives the selected dataset indices, not positions in the current batch. Seed or key deterministic index-aware behavior from those indices; do not use an unstable worker/thread RNG as the identity.SimpleRGBImageDecoderrejects variable-resolution image datasets. Use a crop/resize decoder when a fixed output shape is required.QUASI_RANDOMis unavailable withdistributed=True; use sequential or random order with a shared explicit seed instead.
Verification handoff
For a new pipeline, verify a tiny synthetic .beton fixture: field count and
output order, exact shapes/dtypes/devices, all samples under both full and
partial batches, two epochs with the intended seed/order, and a deliberately
variable-resolution image case if images are involved. The installed facts for
this checkout support CPU synthetic loader smoke and tiny A100 CUDA allocation;
CUDA-specific native suites are optional because the GPU is shared.
Two high-value synthetic checks beyond the baseline tests are: (1) write 7 fixed-size images plus labels, load with indices=[6, 1, 5, 0, 4, 2, 3], drop_last=False, and an index-aware transform that derives its output from each original id; assert the same id keeps the same result across sequential and seeded-random epochs and that the final one-row batch has no stale values; (2) write mixed-resolution images and run a crop-decoder -> native flip -> ToTensor -> ToDevice -> ToTorchImage -> torch module pipeline on a one-row tail, asserting HWC/BCHW layout, dtype, device, and active batch length at every boundary. Run these outside the runtime skill tree as verification cases.
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).