# helia_edge.models.spec

The model spec: one serializable identity per architecture, and the single builder; importable without Keras.

A ``ModelSpec`` is the typed Params of one family (selected by its ``family`` field) and the input shape
without the batch axis. ``build(spec)`` builds it. Families are a closed set: each has a Keras-free
``<family>_params.py`` and a ``build(params, input_shape, *, batch_size=None, name=None)`` in its model module.

## helia_edge.models.spec.ModelParams

`attribute` · `python`

```python
ModelParams = Annotated[ComposerParams | ConformerParams | ConvMixerParams | CorNetParams | EfficientNetParams | FastEnhancerParams | MetaFormerParams | MiniResNetV1Params | MlperfTinyParams | MobileNetV1Params | MobileOneParams | RegNetParams | ResNetParams | SileroVadParams | TcnParams | TimePPGParams | TsMixerParams | UNetParams | UNextParams, Field(discriminator='family')]
```

The Params of any family, discriminated by ``family``.

Source: `helia_edge/models/spec.py:35`

## helia_edge.models.spec.FIXED_INPUT

`constant` · `python`

```python
FIXED_INPUT = (FastEnhancerParams, MlperfTinyParams, SileroVadParams)
```

Families whose input shape follows from their Params (``params.input_shape``); their ``input_shape`` may be None.

Source: `helia_edge/models/spec.py:59`

## helia_edge.models.spec.ModelSpec

`class` · `python`

```python
ModelSpec()
```

The serializable identity of an architecture.

Source: `helia_edge/models/spec.py:63`

### helia_edge.models.spec.ModelSpec.model_config

`attribute` · `python`

```python
model_config = ConfigDict(frozen=True, extra='forbid')
```

Source: `helia_edge/models/spec.py:72`

### helia_edge.models.spec.ModelSpec.params

`attribute` · `python`

```python
params: ModelParams
```

The family's typed Params; ``params.family`` selects the family.

Source: `helia_edge/models/spec.py:74`

### helia_edge.models.spec.ModelSpec.input_shape

`attribute` · `python`

```python
input_shape: tuple[int | None, ...] | None = None
```

Input shape without the batch axis; None for a variable
axis. None for the families in ``FIXED_INPUT``, whose shape follows from their Params.

Source: `helia_edge/models/spec.py:75`

## helia_edge.models.spec.build

`function` · `python`

```python
build(spec: ModelSpec, *, batch_size: int | None = None, name: str | None = None) -> keras.Model
```

Build the model a spec describes.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| spec | ModelSpec | Required | Family Params and input shape. |
| batch_size | int \| None | None | Static batch size; None for a dynamic batch. |
| name | str \| None | None | Model name; the family when None. Give distinct names to combine two models of one family in a Keras graph. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.Model | keras.Model: The model. |

Source: `helia_edge/models/spec.py:89`
