qubee.configs.compile_config.CompileConfig Class Reference

qubee.configs.compile_config.CompileConfig Class Reference#

Mobilint SDK qb Compiler: qubee.configs.compile_config.CompileConfig Class Reference
Mobilint SDK qb Compiler v0.12.0.0
MCS002-KR
Inheritance diagram for qubee.configs.compile_config.CompileConfig:

Public Member Functions

 __init__ (self, str|None calib_data_path, bool use_random_calib, str save_path, str model_nickname, str|None save_msgpack_name, str|None model_path, str inference_scheme, bool save_sample, bool cpu_offload, bool singlecore_compile, int optimize_option, str sample_dtype, dict|None preprocess_dict, int buffer_mode, int start_dram_offset, str version, dict input_shape_dict, ResourceManagementConfig resource_management, QuantizationConfig quantization, AdvancedQuantizationConfig advanced_quantization, LlmConfig llm_config, bool optional=optional)
 Unified compilation configuration object for Mobilint MXQ compilation.
 default_config (cls, **kwargs)
 Create default config with optional parameter overrides.
 from_json (cls, str json_path, **kwargs)
 Load config from JSON file and merge with additional kwargs.
 check_valid_str_configs (self)
 to_dict (self)

Public Attributes

 calib_data_path
 save_path = save_path
 model_nickname = model_nickname
 save_msgpack_name = save_msgpack_name
 model_path = model_path
 inference_scheme = inference_scheme
 save_sample = save_sample
 cpu_offload = cpu_offload
 singlecore_compile = singlecore_compile
 optimize_option = optimize_option
 sample_dtype = sample_dtype
 preprocess_dict = preprocess_dict
 buffer_mode = buffer_mode
 start_dram_offset = start_dram_offset
 version = version
 input_shape_dict = input_shape_dict
 resource_management = resource_management
 quantization = quantization
 advanced_quantization = advanced_quantization
 llm_config = llm_config
 calib_file = tempfile.NamedTemporaryFile(suffix=".txt")

Static Public Attributes

bool optional = False
dict py_to_cpp_name
dict min_max_check = {"optimize_option": [0, None]}
list inference_scheme_types = ["single", "multi", "global", "global4", "global8"]
list sample_dtypes = ["float", "int8"]

Protected Member Functions

 _get_calibration_path (self, str calib_data_path, bool use_random_calib)

Detailed Description

Definition at line 61 of file compile_config.py.

Constructor & Destructor Documentation

◆ __init__()

qubee.configs.compile_config.CompileConfig.__init__ ( self,
str | None calib_data_path,
bool use_random_calib,
str save_path,
str model_nickname,
str | None save_msgpack_name,
str | None model_path,
str inference_scheme,
bool save_sample,
bool cpu_offload,
bool singlecore_compile,
int optimize_option,
str sample_dtype,
dict | None preprocess_dict,
int buffer_mode,
int start_dram_offset,
str version,
dict input_shape_dict,
ResourceManagementConfig resource_management,
QuantizationConfig quantization,
AdvancedQuantizationConfig advanced_quantization,
LlmConfig llm_config,
bool optional = optional )

Unified compilation configuration object for Mobilint MXQ compilation.

Parameters
calib_data_pathstr | 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_calibbool. 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_pathstr. Output MXQ filename/path to generate.
model_nicknamestr. 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_namestr | 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_pathstr | None. (deprecated) Outdated argument. Please refer to the model usage in the mxq_compile function.
inference_schemestr. NPU inference scheme string. Must be one of:
"single", "multi", "global", "global4", "global8" ("global" and "global8" behave identically).
save_samplebool. When True, saves representative input/output tensors for debugging.
cpu_offloadbool. Enables CPU offload for unsupported operator groups/segments during NPU inference. This is a beta feature and is recommended only for special cases.
singlecore_compilebool. Forces single-core compilation mode. Commonly used to compile large language models.
optimize_optionint. Compiler optimization selector.
sample_dtypestring. Data type for saved sample inference outputs: "float" or "int8". Primarily intended for debugging and is now rarely used.
preprocess_dictdict | None. Additional preprocessing metadata.
buffer_modeint. Buffer serialization mode for saving .mblt file. Common conventions:
  • 0: naïve buffer serialization
  • 1: mmap-backed buffer serialization
start_dram_offsetint. Start Dram Address Offset (default = 0).
versionstr. qubee version.
input_shape_dictdict. Optional HWC input shape dictionary used for multi-shape compilation (for example {"input0": [[224, 224, 3], [256, 256, 3]]}).
resource_managementResourceManagementConfig. Resource management configuration class.
quantizationQuantizationConfig. Quantization configuration class (e.g., calibration strategy, bit-widths, per-tensor/per-channel settings, quantization scheme/policies).
advanced_quantizationAdvancedQuantizationConfig. Advanced quantization configuration block for fine-grained or experimental controls beyond the basic quantization settings.
llm_configLlmConfig. LLM-specific configuration class. optional bool. Indicates whether this config is optional. Use the default value defined as a class variable.

Definition at line 89 of file compile_config.py.

Member Function Documentation

◆ default_config()

qubee.configs.compile_config.CompileConfig.default_config ( cls,
** kwargs )

Create default config with optional parameter overrides.

Args: **kwargs: Parameters to override defaults

Definition at line 206 of file compile_config.py.

◆ from_json()

qubee.configs.compile_config.CompileConfig.from_json ( cls,
str json_path,
** 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.)

Definition at line 244 of file compile_config.py.

◆ check_valid_str_configs()

qubee.configs.compile_config.CompileConfig.check_valid_str_configs ( self)

Definition at line 276 of file compile_config.py.

◆ to_dict()

qubee.configs.compile_config.CompileConfig.to_dict ( self)

Definition at line 292 of file compile_config.py.

◆ _get_calibration_path()

qubee.configs.compile_config.CompileConfig._get_calibration_path ( self,
str calib_data_path,
bool use_random_calib )
protected

Definition at line 313 of file compile_config.py.

Member Data Documentation

◆ optional

bool qubee.configs.compile_config.CompileConfig.optional = False
static

Definition at line 62 of file compile_config.py.

◆ py_to_cpp_name

dict qubee.configs.compile_config.CompileConfig.py_to_cpp_name
static
Initial value:
= {
"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",
}

Definition at line 63 of file compile_config.py.

◆ min_max_check

dict qubee.configs.compile_config.CompileConfig.min_max_check = {"optimize_option": [0, None]}
static

Definition at line 79 of file compile_config.py.

◆ inference_scheme_types

list qubee.configs.compile_config.CompileConfig.inference_scheme_types = ["single", "multi", "global", "global4", "global8"]
static

Definition at line 80 of file compile_config.py.

◆ sample_dtypes

list qubee.configs.compile_config.CompileConfig.sample_dtypes = ["float", "int8"]
static

Definition at line 81 of file compile_config.py.

◆ calib_data_path

qubee.configs.compile_config.CompileConfig.calib_data_path
Initial value:
= self._get_calibration_path(
calib_data_path, use_random_calib
)

Definition at line 167 of file compile_config.py.

◆ save_path

qubee.configs.compile_config.CompileConfig.save_path = save_path

Definition at line 170 of file compile_config.py.

◆ model_nickname

qubee.configs.compile_config.CompileConfig.model_nickname = model_nickname

Definition at line 171 of file compile_config.py.

◆ save_msgpack_name

qubee.configs.compile_config.CompileConfig.save_msgpack_name = save_msgpack_name

Definition at line 172 of file compile_config.py.

◆ model_path

qubee.configs.compile_config.CompileConfig.model_path = model_path

Definition at line 173 of file compile_config.py.

◆ inference_scheme

qubee.configs.compile_config.CompileConfig.inference_scheme = inference_scheme

Definition at line 174 of file compile_config.py.

◆ save_sample

qubee.configs.compile_config.CompileConfig.save_sample = save_sample

Definition at line 175 of file compile_config.py.

◆ cpu_offload

qubee.configs.compile_config.CompileConfig.cpu_offload = cpu_offload

Definition at line 176 of file compile_config.py.

◆ singlecore_compile

qubee.configs.compile_config.CompileConfig.singlecore_compile = singlecore_compile

Definition at line 177 of file compile_config.py.

◆ optimize_option

qubee.configs.compile_config.CompileConfig.optimize_option = optimize_option

Definition at line 178 of file compile_config.py.

◆ sample_dtype

qubee.configs.compile_config.CompileConfig.sample_dtype = sample_dtype

Definition at line 179 of file compile_config.py.

◆ preprocess_dict

qubee.configs.compile_config.CompileConfig.preprocess_dict = preprocess_dict

Definition at line 180 of file compile_config.py.

◆ buffer_mode

qubee.configs.compile_config.CompileConfig.buffer_mode = buffer_mode

Definition at line 181 of file compile_config.py.

◆ start_dram_offset

qubee.configs.compile_config.CompileConfig.start_dram_offset = start_dram_offset

Definition at line 182 of file compile_config.py.

◆ version

qubee.configs.compile_config.CompileConfig.version = version

Definition at line 183 of file compile_config.py.

◆ input_shape_dict

qubee.configs.compile_config.CompileConfig.input_shape_dict = input_shape_dict

Definition at line 184 of file compile_config.py.

◆ resource_management

qubee.configs.compile_config.CompileConfig.resource_management = resource_management

Definition at line 187 of file compile_config.py.

◆ quantization

qubee.configs.compile_config.CompileConfig.quantization = quantization

Definition at line 188 of file compile_config.py.

◆ advanced_quantization

qubee.configs.compile_config.CompileConfig.advanced_quantization = advanced_quantization

Definition at line 189 of file compile_config.py.

◆ llm_config

qubee.configs.compile_config.CompileConfig.llm_config = llm_config

Definition at line 190 of file compile_config.py.

◆ calib_file

qubee.configs.compile_config.CompileConfig.calib_file = tempfile.NamedTemporaryFile(suffix=".txt")

Definition at line 324 of file compile_config.py.


The documentation for this class was generated from the following file: