> Documentation Index
> Fetch the complete documentation index at: https://docs.mobilint.com/compiler/kr/v1.0/llms.txt
> Use this file to discover all available pages before exploring further.
> Append index.md to any page URL for its Markdown.
> All Mobilint manuals: https://docs.mobilint.com/llms.txt

# qbcompiler.configs.compile\_config

## Attributes

| Name | Description |
| --- | --- |
| [`logger`](<#logger>) |  |

### logger

```python
logger = get_logger(__name__)
```

## CompileConfig

```python
class CompileConfig(ConfigABC)
```

### Attributes

| Name | Description |
| --- | --- |
| [`optional`](<#compileconfig-optional>) |  |
| [`py_to_cpp_name`](<#compileconfig-py-to-cpp-name>) |  |
| [`min_max_check`](<#compileconfig-min-max-check>) |  |
| [`inference_scheme_types`](<#compileconfig-inference-scheme-types>) |  |
| [`sample_dtypes`](<#compileconfig-sample-dtypes>) | Unified compilation configuration object for Mobilint MXQ compilation. |

#### optional

```python
optional = False
```

#### py\_to\_cpp\_name

```python
py_to_cpp_name = {
    "calib_data_path": "calibData",
    "save_path": "savePath",
    "model_nickname": "modelNickname",
    "save_msgpack_name": "saveMsgpackName",
    "model_path": "modelPath",
    "inference_scheme": "inferenceScheme",
    "save_sample": "saveSample",
    "cpu_offload": "cpuOffload",
    "optimize_option": "optimizeOption",
    "sample_dtype": "sampleDtype",
    "version": "version",
}
```

#### min\_max\_check

```python
min_max_check = {"optimize_option": [0, None]}
```

#### inference\_scheme\_types

```python
inference_scheme_types = ["single", "multi", "global", "global4", "global8", "all"]
```

#### sample\_dtypes

```python
sample_dtypes = ["float", "int8"]
```

Unified compilation configuration object for Mobilint MXQ compilation.

This config consolidates compilation-related parameters and sub-config class into a single structure.

### Methods

| Name | Description |
| --- | --- |
| [`__init__`](<#compileconfig-init>) | Unified compilation configuration object for Mobilint MXQ compilation. |
| [`default_config`](<#compileconfig-default-config>) | Create default config with optional parameter overrides. |
| [`from_json`](<#compileconfig-from-json>) | Load config from JSON file and merge with additional kwargs. |
| [`check_valid_str_configs`](<#compileconfig-check-valid-str-configs>) |  |
| [`to_dict`](<#compileconfig-to-dict>) |  |

#### \_\_init\_\_

```python
def __init__(
    self,
    calib_data_path: str | None,
    use_random_calib: bool,
    save_path: str,
    model_nickname: str,
    save_msgpack_name: str | None,
    model_path: str | None,
    inference_scheme: str,
    save_sample: bool,
    cpu_offload: bool,
    optimize_option: int,
    sample_dtype: str,
    buffer_mode: int,
    version: str,
    input_shape_dict: dict,
    resource_management: ResourceManagementConfig,
    quantization: QuantizationConfig,
    advanced_quantization: AdvancedQuantizationConfig,
    llm_config: LlmConfig,
    input_process: InputProcessConfig,
    optional: bool = optional,
)
```

Unified compilation configuration object for Mobilint MXQ compilation.

**Parameters**

- `calib_data_path` — str | None. Path to calibration dataset. Accepts either:  
  \- a directory containing pre-processed NumPy samples, or  
  \- a .txt/.json meta file listing NumPy sample file paths.  
  If `use_random_calib` is True, this may be None. Otherwise, a valid path is expected for quantized compilation workflows.
- `use_random_calib` — bool. When True, uses randomly generated calibration samples (typically for smoke testing and compilability validation). When False, `calib_data_path` is used as the calibration source.
- `save_path` — str. Output MXQ filename/path to generate.
- `model_nickname` — str. Model nickname used as a fallback identifier when intermediate results need to be saved. It is recommended to set this to the filename component of `save_path`.
- `save_msgpack_name` — str | None. filename/path to save an intermediate serialized representation (msgpack) of the high-level compiled model/graph. Primarily intended for debugging and is now rarely used.
- `model_path` — str | None. (deprecated) Outdated argument. Please refer to the model usage in the `mxq_compile` function.
- `inference_scheme` — str. NPU inference scheme string. Must be one of:  
  `"single"`, `"multi"`, `"global"`, `"global4"`, `"global8"` (`"global"` and `"global8"` behave identically).
- `save_sample` — bool. When True, saves representative input/output tensors for debugging.
- `cpu_offload` — bool. Enables CPU offload for unsupported operator groups/segments during NPU inference. This is a beta feature and is recommended only for special cases.
- `optimize_option` — int. Compiler optimization selector.
- `sample_dtype` — string. Data type for saved sample inference outputs: "float" or "int8". Primarily intended for debugging and is now rarely used.
- `buffer_mode` — int. Buffer serialization mode for saving .mblt file. Common conventions:  
  \- 0: naïve buffer serialization  
  \- 1: mmap-backed buffer serialization
- `version` — str. qbcompiler version.
- `input_shape_dict` — dict. Optional HWC input shape dictionary used for multi-shape compilation (for example {"input0": \[\[224, 224, 3\], \[256, 256, 3\]\]}).
- `resource_management` — [ResourceManagementConfig](<https://docs.mobilint.com/compiler/kr/v1.0/api/python/qbcompiler.configs.resource_management_config/#resourcemanagementconfig>). Resource management configuration class.
- `quantization` — [QuantizationConfig](<https://docs.mobilint.com/compiler/kr/v1.0/api/python/qbcompiler.configs.quantization_config/#quantizationconfig>). Quantization configuration class (e.g., calibration strategy, bit-widths, per-tensor/per-channel settings, quantization scheme/policies).
- `advanced_quantization` — [AdvancedQuantizationConfig](<https://docs.mobilint.com/compiler/kr/v1.0/api/python/qbcompiler.configs.advanced_quantization_config/#advancedquantizationconfig>). Advanced quantization configuration block for fine-grained or experimental controls beyond the basic quantization settings.
- `llm_config` — [LlmConfig](<https://docs.mobilint.com/compiler/kr/v1.0/api/python/qbcompiler.configs.llm_config/#llmconfig>). LLM-specific configuration class.
- `input_process` — [InputProcessConfig](<https://docs.mobilint.com/compiler/kr/v1.0/api/python/qbcompiler.configs.input_process_config/#inputprocessconfig>). Unified input processing configuration containing uint8 input handling, image channels, and preprocessing pipeline settings. optional bool. Indicates whether this config is optional. Use the default value defined as a class variable.

#### default\_config

```python
def default_config(cls, **kwargs)
```

Create default config with optional parameter overrides.

Args: \*\*kwargs: Parameters to override defaults

#### from\_json

```python
def from_json(cls, json_path: str, **kwargs)
```

Load config from JSON file and merge with additional kwargs.

Args: json\_path: Path to JSON configuration file \*\*kwargs: Additional compile-time parameters (calib\_data\_path, save\_path, etc.)

#### check\_valid\_str\_configs

```python
def check_valid_str_configs(self)
```

#### to\_dict

```python
def to_dict(self)
```

## Functions

| Name | Description |
| --- | --- |
| [`get_compile_config`](<#get-compile-config>) | Create Compilation Config with partial parameters merged with defaults. |

### get\_compile\_config

```python
def get_compile_config(
    calib_data_path=None,
    use_random_calib=False,
    save_path="./tmp.mxq",
    save_msgpack_name=None,
    model_nickname="temporary",
    model_path=None,
    inference_scheme="single",
    save_sample=False,
    cpu_offload=False,
    optimize_option=1,
    sample_dtype="float",
    buffer_mode=1,
    input_shape_dict=dict(),
    resource_management_config: Optional[ResourceManagementConfig] = None,
    quantization_config: Optional[QuantizationConfig] = None,
    llm_config: Optional[LlmConfig] = None,
    advanced_quantization_config: Optional[AdvancedQuantizationConfig] = None,
    input_process_config: Optional[InputProcessConfig] = None,
    version=__version__,
    **kwargs,
)
```

Create Compilation Config with partial parameters merged with defaults.
