qubee.configs.compile_config¶
Attributes¶
| Name | Description |
|---|---|
logger |
logger¶
CompileConfig¶
Attributes¶
| Name | Description |
|---|---|
optional |
|
py_to_cpp_name |
|
min_max_check |
|
inference_scheme_types |
|
sample_dtypes |
Unified compilation configuration object for Mobilint MXQ compilation. |
optional¶
py_to_cpp_name¶
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",
"singlecore_compile": "singlecoreCompile",
"optimize_option": "optimizeOption",
"sample_dtype": "sampleDtype",
"preprocess_dict": "preprocess",
"start_dram_offset": "startDramOffset",
"version": "version",
}
min_max_check¶
inference_scheme_types¶
sample_dtypes¶
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__ |
Unified compilation configuration object for Mobilint MXQ compilation. |
default_config |
Create default config with optional parameter overrides. |
from_json |
Load config from JSON file and merge with additional kwargs. |
check_valid_str_configs |
|
to_dict |
__init__¶
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,
singlecore_compile: bool,
optimize_option: int,
sample_dtype: str,
preprocess_dict: dict | None,
buffer_mode: int,
start_dram_offset: int,
version: str,
input_shape_dict: dict,
resource_management: ResourceManagementConfig,
quantization: QuantizationConfig,
advanced_quantization: AdvancedQuantizationConfig,
llm_config: LlmConfig,
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.
Ifuse_random_calibis 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_pathis 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 ofsave_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 themxq_compilefunction.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.singlecore_compile— bool. Forces single-core compilation mode. Commonly used to compile large language models.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.preprocess_dict— dict | None. Additional preprocessing metadata.buffer_mode— int. Buffer serialization mode for saving .mblt file. Common conventions:
- 0: naïve buffer serialization
- 1: mmap-backed buffer serializationstart_dram_offset— int. Start Dram Address Offset (default = 0).version— str. qubee 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. Resource management configuration class.quantization— QuantizationConfig. Quantization configuration class (e.g., calibration strategy, bit-widths, per-tensor/per-channel settings, quantization scheme/policies).advanced_quantization— AdvancedQuantizationConfig. Advanced quantization configuration block for fine-grained or experimental controls beyond the basic quantization settings.llm_config— LlmConfig. LLM-specific configuration class. optional bool. Indicates whether this config is optional. Use the default value defined as a class variable.
default_config¶
Create default config with optional parameter overrides.
Args: **kwargs: Parameters to override defaults
from_json¶
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¶
to_dict¶
Functions¶
| Name | Description |
|---|---|
get_compile_config |
Create Compilation Config with partial parameters merged with defaults. |
get_compile_config¶
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,
singlecore_compile=False,
optimize_option=0,
sample_dtype="float",
preprocess_dict=None,
buffer_mode=1,
start_dram_offset=0,
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,
version=__version__,
**kwargs,
)
Create Compilation Config with partial parameters merged with defaults.