Dataset API
See Add a dataset for registration and calibration examples.
DatasetABC
Bases: ABC
Abstract dataset contract for modular pipeline implementations.
Implementations must provide :meth:load and may optionally override the
default hooks for config validation and calibration-data selection. By
default, :attr:name returns the implementing class name,
:meth:validate_config performs no validation, and
:meth:make_calibration_data forwards bundle.calibration unchanged.
load(dataset_config)
abstractmethod
Load, preprocess, and normalize a dataset bundle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_config
|
Any
|
Dataset-local configuration subtree. |
required |
Returns:
| Type | Description |
|---|---|
DatasetBundle
|
Normalized dataset package ready for downstream pipeline stages. The returned bundle is also the source object consumed by later dataset hooks, including the default calibration-data passthrough. |
validate_config(dataset_config)
Validate dataset-local configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_config
|
Any
|
Dataset-local configuration subtree. |
required |
Returns:
| Type | Description |
|---|---|
None
|
The default implementation intentionally performs no validation and accepts any config object. |
make_calibration_data(bundle, dataset_config)
Return calibration data used by export-time representative sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle
|
DatasetBundle
|
Normalized dataset package produced by :meth: |
required |
dataset_config
|
Any
|
Dataset-local configuration subtree. |
required |
Returns:
| Type | Description |
|---|---|
DataSplit | None
|
Calibration split when one is available. The default implementation
ignores |
DatasetBundle
dataclass
Normalized dataset package returned by a dataset implementation.
A valid bundle always includes a training split. Validation, test, and calibration splits are optional attachments populated only when the dataset can supply them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train
|
DataSplit
|
Training split. |
required |
val
|
DataSplit | None
|
Validation split when available. |
None
|
test
|
DataSplit | None
|
Test split when available. |
None
|
calibration
|
DataSplit | None
|
Calibration split used for export-time representative data when needed. |
None
|
input_shape
|
tuple[int, ...] | None
|
Shape of one logical input example, excluding the batch dimension. |
None
|
input_dtype
|
str | None
|
Input dtype label expected by the model family. |
None
|
metadata
|
dict[str, Any]
|
Dataset-wide metadata carried into later pipeline stages. |
dict()
|
Attributes:
| Name | Type | Description |
|---|---|---|
train |
DataSplit
|
Training split. |
val |
DataSplit | None
|
Validation split when available. |
test |
DataSplit | None
|
Test split when available. |
calibration |
DataSplit | None
|
Calibration split used for export-time representative data when needed. |
input_shape |
tuple[int, ...] | None
|
Shape of one logical input example, excluding the batch dimension. |
input_dtype |
str | None
|
Input dtype label expected by the model family. |
metadata |
dict[str, Any]
|
Dataset-wide metadata carried into later pipeline stages. |
DataSplit
dataclass
Container for one dataset partition.
This dataclass is a passive transport container. It groups split payloads without validating, coercing, or copying them on construction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Any
|
Model-ready inputs for one split. The exact runtime type is intentionally left broad so dataset implementations can supply arrays, tensors, or other Keras-compatible structures. |
required |
targets
|
Any
|
Split targets interpreted by the owning task. |
required |
sample_weights
|
Any | None
|
Optional sample-weight payload forwarded to task or training code. |
None
|
metadata
|
dict[str, Any]
|
Split-local metadata. Defaults to an empty dictionary. |
dict()
|
Attributes:
| Name | Type | Description |
|---|---|---|
inputs |
Any
|
Model-ready inputs for one split. The exact runtime type is intentionally left broad so dataset implementations can supply arrays, tensors, or other Keras-compatible structures. |
targets |
Any
|
Split targets interpreted by the owning task. |
sample_weights |
Any | None
|
Optional sample-weight payload forwarded to task or training code. |
metadata |
dict[str, Any]
|
Split-local metadata. Defaults to an empty dictionary. |