generators-and-frameworks
Use Augmentor generator APIs, array generators, framework preprocessing callables, torch-style transforms, and DataFramePipeline boundaries without making optional ML frameworks required.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- generators-and-frameworks
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use Augmentor generator APIs, array generators, framework preprocessing callables, torch-style transforms, and DataFramePipeline boundaries without making optional ML frameworks required.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md8.4 KB
- 参考文档references/framework-integrations.md6.9 KB
- 参考文档references/troubleshooting.md5.2 KB
- 脚本scripts/augmentor_generator_smoke.py9.2 KB
03 SKILL.md 正文
Generators and framework integrations
Use this sub-skill when a task asks for Augmentor data generators, in-memory array batches, Keras/TensorFlow-style training integration, PyTorch/torchvision-style transforms, or DataFrame-backed image sources.
Route here for
Pipeline.keras_generator(batch_size, scaled=True, image_data_format="channels_last")from a directory-backed pipeline.Pipeline.keras_generator_from_array(images, labels, batch_size, scaled=True, image_data_format="channels_last")from NumPy-like image arrays.Pipeline.keras_preprocess_func()for a KerasImageDataGeneratorpreprocessing callable.Pipeline.torch_transform()for a callable that can be placed in a torchvision transform composition.DataFramePipeline(source_dataframe, image_col, category_col, output_directory="output", save_format=None)and its pandas compatibility boundary.
Route away
- For basic disk-backed
Pipeline(...),sample(...), output directories, class-folder scanning, or save formats, use thepipeline-augmentationsub-skill. - For
DataPipelinein-memory grouped images/masks and mask-safe array augmentation, use themasks-and-arrayssub-skill. - For operation selection, parameter ranges, custom operations, and validation errors, use the
operation-referencesub-skill.
Required operating facts
- Direct Augmentor generator methods are plain Python generator/callable surfaces;
keras_generator,keras_generator_from_array,keras_preprocess_func, andtorch_transformdo not import Keras, TensorFlow, torch, or torchvision by themselves. - Keras/TensorFlow and torch/torchvision are optional downstream framework dependencies only when the user actually trains a model or composes framework transforms.
- Framework training examples were reference evidence only. Use the distilled recipes in this skill; do not depend on notebooks or external datasets.
scaled=Trueconverts image batches tofloat32and divides pixel values by255.scaled=Falsekeeps unscaled image array values.- Choose
image_data_format="channels_last"for(batch, height, width, channels)and"channels_first"for(batch, channels, height, width). keras_generator_from_arrayrequireslen(images) == len(labels)and raisesIndexErrorif they differ.DataFramePipelinerequires pandas, but this repository version callsCategorical.get_values(), which is missing in pandas 1.5.3 and 3.0.5. Treat DataFramePipeline as an optional legacy surface unless the user pins/patches it.
Bundled references and helper
- Framework integration recipes covers Keras-style generators, preprocessing callbacks, torch-style transforms, and optional dependency boundaries.
- API reference lists signatures, shape contracts, label behavior, scaling, and DataFramePipeline semantics.
- Troubleshooting covers shape mismatches, scaling surprises, missing optional dependencies, DataFramePipeline pandas failures, and labels issues.
- Generator smoke helper creates tiny synthetic images and arrays, exercises direct generator calls without Keras/TensorFlow, exercises
torch_transform()without torchvision, and optionally checks DataFramePipeline.
Minimal decision checklist
- Identify the data source: disk pipeline, NumPy arrays, Keras preprocessing array stream, torch-style PIL transform, or pandas DataFrame.
- Pick the batch layout that matches the downstream model:
channels_lastorchannels_first. - Decide whether the model expects scaled float data (
scaled=True) or raw pixel values (scaled=False). - If pandas is requested, warn about the known
Categorical.get_values()issue and prefer ordinaryPipeline/DataPipeline, pinning/patching, or maintaining a patchedscan_dataframe. - Run the bundled smoke helper in the target environment before integrating with a training loop.
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).