Add a dataset
A dataset adapter loads local data and supplies model-ready splits, input shape and dtype, and metadata for the selected task and model family.
- Add a class under
src/crest/datasets/that implementsDatasetABC.load(dataset_config). Return aDatasetBundlewith a training split. Supply the validation and test splits required by the selected task. Setinput_shapeto the shape of one example without its batch dimension. - Dataset hooks receive
dataset.params. Implementvalidate_config(dataset_config)to check the parameters the adapter owns. Keep preprocessing and cache validation in the adapter or its preparation script. Check the loaded data for shape, dtype, split integrity, and metadata consistency. - Populate
bundle.calibrationfor representative export samples. The defaultmake_calibration_datareturns that field. Override it if your adapter needs a deterministic sampling rule or a fallback. - Add a guarded call to
dataset_registry.register("your_key", YourDataset)inbuiltin_components.py, following the existing registrations. Select your key underdataset.nameand place its options underdataset.params.
In the audio classification example, the UrbanSound8K adapter reads precomputed features from cache_dir and supplies class names, class count, and label encoding to the sound classification task. For example, these fixed-split settings come from nas_config_audio_portenta.yaml.
dataset:
name: urbansound8k_mel
params:
cache_dir: "data/urbansound8k/cache/v2_logmel_16k_2s_64mels_25ms_10ms_folds"
batch_period_ms: 2000
Use urbansound8k_mel.py as a template for cached features or oxiod.py to wrap an existing splitter. Use a tiny local fixture to check deterministic loading, validation failures, and the actual calibration split. The UrbanSound8K tests are in test_urbansound8k_mel_dataset.py.
For more information, read the full dataset README on GitHub.