name: custom-models-data
description: "Add or adapt PocketFlow datasets, ModelHelper classes, built-in
model/data combinations, and custom run scripts for compression tasks."
disable-model-invocation: true
metadata:
disco-role: operating
license: NOASSERTION
PocketFlow Custom Models and Data
Use this sub-skill when the user wants to add a new dataset, write or adapt a ModelHelper, reuse a built-in model/data combination, or create the *_at_<dataset>_run.py execution script that hands a helper to PocketFlow learners.
Route first
- For learner IDs, compression algorithms, distillation, pruning, sparsification, or quantization flags, route to compression-learners.
- For
path.conf, local/docker/seven launchers, command preview, GPU discovery, or runtime setup, route to execution-config.
- Stay here for the Dataset/ModelHelper/run-script contracts and for adapting built-in dataset/model pairs.
Operating checklist
- Identify the task shape: image classification uses
(images, one_hot_labels) iterators; detection-style helpers may return dictionaries and packed object tensors.
- Choose the closest built-in combination from built-in-models-datasets.md. Prefer adapting a new file rather than editing a built-in helper directly.
- Implement a dataset subclass that calls
AbstractDataset.__init__(is_train), sets the path-dependent file pattern or overrides build(), and returns TensorFlow 1.x iterators.
- Implement
ModelHelper against the current abstract contract in api-contracts.md: call AbstractModelHelper.__init__(data_format, forward_w_labels=False), create no TensorFlow ops in the constructor, and implement dataset, forward, loss, learning-rate, and name properties.
- Create a run script that imports
ModelHelper, defines the common PocketFlow flags, calls create_learner(sm_writer, model_helper), and dispatches train or eval.
- If the user needs a starter scaffold, use the bundled helper generate_model_helper_skeleton.py. This helper is a DisCo template generator, not an official PocketFlow source script.
- Before running training, validate that
path.conf uses the dataset key implied by the run script name and that the selected learner supports the helper's forward signature.
References
- API contracts - exact Dataset, ModelHelper, run-script, data-format, and
forward_w_labels contracts.
- Built-in models and datasets - source workflow matrix, data formats, key flags, and path-key conventions.
- Custom model template - compact implementation recipe distilled from the Fashion-MNIST-style example.
- Troubleshooting - common data directory, shape, label, TensorFlow 1.x, and run-script failures.
Safety boundaries
- Do not start downloads or training from this sub-skill. Generate or review code/templates, then route execution setup to execution-config.
- Do not assume TensorFlow 2 compatibility; PocketFlow is a TensorFlow 1.x, Python 3.6-era checkout-style codebase.
- Do not claim a bundled helper is part of the upstream PocketFlow repository; bundled helpers live only in this generated skill tree.