# config

Python API: `hubai_sdk.utils.config`

Parse and validate model conversion configuration.

[Config](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/config.md) is the root
configuration object used by hosted conversion. It accepts either a compact single-stage mapping or an explicit `stages` mapping.
For model formats with embedded metadata, missing tensor shapes and data types are inferred from the source file.

> **Example**
> A compact YAML configuration can define preprocessing and target options.

```yaml
name: detector
input_model: detector.onnx
inputs:
  - name: images
    shape: [1, 3, 640, 640]
    layout: NCHW
    encoding:
      from: RGB
      to: BGR
    mean_values: imagenet
rvc2:
  number_of_shaves: 8
  superblob: true
```

Top-level tensor shortcuts such as `shape`, `layout`, `mean_values`, and `scale_values` are propagated to inputs that do not
override them. Unknown fields are rejected to catch misspelled options early.

## Classes

### BlobBaseConfig

Shared OpenVINO Model Optimizer and blob compiler options.

#### Attributes

##### compile_tool_args

##### compress_to_fp16

##### mo_args

### Config

Root configuration for a single- or multi-stage model.

A mapping without `stages` is wrapped as a single stage automatically. Shared keys placed beside `stages` are copied into each
stage unless the stage supplies its own value.

#### Methods

##### get_stage_config

```python
def get_stage_config(stage: str | None) -> SingleStageConfig:
```

Return a stage config, inferring it for single-stage models.

#### Attributes

##### name

Pipeline name. Derived from stage names when omitted.

##### rich_logging

Whether conversion tools should use rich terminal logs.

##### stages

Stage configurations keyed by stage name.

### CustomBaseModel

Base for strict configuration models that reject unknown fields.

#### Attributes

##### model_config

### EncodingConfig

Input channel conversion performed before inference.

`from_` is the encoding supplied by the application and `to` is the encoding expected by the model. The input field and serialized
field name for `from_` is `"from"`.

#### Attributes

##### from_

### HailoConfig

Hailo Dataflow Compiler and hardware options.

#### Attributes

##### alls

##### batch_size

##### compression_level

##### disable_compilation

##### hw_arch

##### optimization_level

### InputConfig

Tensor metadata and preprocessing for one model input.

Scalar mean and scale values are expanded to three channels. The named value `"imagenet"` expands to the standard ImageNet
preprocessing vectors. One-channel inputs are normalized to grayscale encoding.

#### Attributes

##### encoding

Source and destination channel ordering.

##### encoding_mismatch

##### frozen_value

Constant value for an input that is not supplied at run time.

##### is_color_input

##### mean_values

Per-channel value subtracted during preprocessing.

##### scale_values

Per-channel divisor applied during preprocessing.

### OutputConfig

Shape, layout, and data type of one model output.

#### Methods

##### validate_layout

```python
def validate_layout(self) -> Self:
```

#### Attributes

##### data_type

Tensor element type.

##### layout

Dimension labels such as `"NCHW"`. A default is inferred from `shape` when omitted.

##### name

Tensor name in the source model.

##### shape

Tensor dimensions. May be omitted when they can be inferred.

### RVC2Config

RVC2 compilation options.

A superblob always uses eight SHAVE cores; validation changes `number_of_shaves` to `8` when necessary.

#### Attributes

##### n_workers

##### number_of_shaves

##### superblob

### RVC3Config

RVC3 compilation and POT target options.

### RVC4Config

Qualcomm SNPE conversion, quantization, and graph options.

#### Attributes

##### compress_to_fp16

##### disable_calibration

##### htp_socs

##### keep_raw_images

##### optimization_level

##### snpe_dlc_graph_prepare_args

##### snpe_dlc_quant_args

##### snpe_onnx_to_dlc_args

##### use_per_channel_quantization

##### use_per_row_quantization

### SingleStageConfig

Configuration for one model in a conversion pipeline.

Inputs and outputs are inferred from ONNX, OpenVINO IR, and TFLite models when omitted. PyTorch inputs are supported for YOLO
models and use the configured `yolo_input_shape`.

#### Methods

##### get_target_config

```python
def get_target_config(target: Target) -> TargetConfig:
```

Returns the target configuration for the given target.

#### Attributes

##### disable_onnx_optimization

##### disable_onnx_simplification

##### hailo

Hailo-specific settings.

##### input_bin

Weights file paired with an OpenVINO XML graph.

##### input_file_type

##### input_model

Local or remote path to the source model.

##### inputs

Input tensor definitions and preprocessing.

##### intermediate_outputs_remote_url

##### keep_intermediate_outputs

##### output_remote_url

##### outputs

Output tensor definitions.

##### put_file_plugin

##### rvc2

RVC2-specific settings.

##### rvc3

RVC3-specific settings.

##### rvc4

RVC4-specific settings.

### TargetConfig

Options shared by every conversion target.

#### Attributes

##### disable_calibration

## Attributes

### NAMED_VALUES
