Skip to content

Registration and selection

Each software registry maps a configured name to a component class. The extension guides show where to register components and how to select them in a run.

ComponentRegistry dataclass

Bases: Generic[T]

Registry for explicitly named component classes.

The registry stores classes, not instances. Registration keys are normalized with :meth:str.strip before duplicate checks and lookups so surrounding whitespace does not create distinct entries.

Parameters:

Name Type Description Default
component_kind str

Human-readable component label used in error messages.

required

Attributes:

Name Type Description
component_kind str

Human-readable component label used in error messages.

register(name, component_cls)

Register a component class under a stable string key.

Parameters:

Name Type Description Default
name str

Stable registration key.

required
component_cls type[T]

Component class associated with name.

required

Returns:

Type Description
None

Raises:

Type Description
ValueError

If name is empty or already registered.

get(name)

Return the component class registered under name.

Parameters:

Name Type Description Default
name str

Stable registration key. Leading and trailing whitespace is removed before lookup.

required

Returns:

Type Description
type[T]

Registered component class.

Raises:

Type Description
KeyError

If name is not registered.

names()

Return registered names in sorted order.

Returns:

Type Description
tuple[str, ...]

Sorted registered component names.

resolve_component_selection(config)

Resolve explicit dataset, task, and model-family selections.

Parameters:

Name Type Description Default
config Any

Loaded HIL/NAS configuration object.

required

Returns:

Type Description
dict[str, Any]

Resolved component names and local configuration subtrees. The returned mapping always includes dataset_name, dataset_config, task_name, task_config, model_family_name, and model_config. CREST now requires explicit dataset, task, and model blocks and does not fall back to legacy top-level config fields.

Raises:

Type Description
KeyError

If any required component block or required field is missing.

TypeError

If a config subtree that must be mapping-like cannot be normalized.

ensure_builtin_components_registered()

Register the built-in CREST components exactly once.

Returns:

Type Description
None

The function mutates the module-level registries only when a built-in component has not already been registered by name. Existing registry entries are left untouched so repeated calls are idempotent.

bootstrap_pipeline(config, *, dataset=None, bundle=None, checkpoint_path=None, early_stopping_patience=None)

Bootstrap the modular dataset/task/model-family pipeline for one config.

Parameters:

Name Type Description Default
config Any

Loaded runtime configuration.

required
dataset Any | None

Pre-instantiated dataset component to reuse.

None
bundle DatasetBundle | None

Preloaded dataset bundle to reuse instead of reloading the dataset.

None
checkpoint_path Path | None

Explicit checkpoint path override for task construction.

None
early_stopping_patience int | None

Explicit early-stopping patience override for task construction.

None

Returns:

Type Description
BootstrappedPipeline

Fully resolved modular runtime state, including task metric validation for the active NAS policy.

BootstrappedPipeline dataclass

Resolved modular runtime state for one config.

Parameters:

Name Type Description Default
selection dict[str, Any]

Resolved component names and local config payloads.

required
dataset Any

Instantiated dataset component.

required
task Any

Instantiated task component.

required
model_family Any

Instantiated model-family component.

required
bundle DatasetBundle

Loaded dataset bundle.

required
target_spec TargetSpec

Task-owned target specification.

required
metric_contract TaskMetricContract

Task-owned metric declaration.

required
model_build_context ModelBuildContext

Normalized build context shared with the model family.

required

Attributes:

Name Type Description
selection dict[str, Any]

Resolved component names and local config payloads.

dataset Any

Instantiated dataset component.

task Any

Instantiated task component.

model_family Any

Instantiated model-family component.

bundle DatasetBundle

Loaded dataset bundle.

target_spec TargetSpec

Task-owned target specification.

metric_contract TaskMetricContract

Task-owned metric declaration.

model_build_context ModelBuildContext

Normalized build context shared with the model family.