qbcompiler.configs.models.CompileConfig Class Reference

qbcompiler.configs.models.CompileConfig Class Reference#

Mobilint SDK qb Compiler: qbcompiler.configs.models.CompileConfig Class Reference
Mobilint SDK qb Compiler v1.3
MCS002-KR
qbcompiler.configs.models.CompileConfig Class Reference

Unified compilation configuration for Mobilint MXQ compilation. More...

Inheritance diagram for qbcompiler.configs.models.CompileConfig:

Public Member Functions

"CompileConfig" with_uint8_input (self, **kwargs)
 Return a copy with uint8_input settings enabled.
"CompileConfig" with_preprocessing (self, **kwargs)
 Return a copy with preprocessing settings enabled.
"CompileConfig" with_hessian_quant (self, **kwargs)
 Return a copy with hessian_quant settings enabled.
"CompileConfig" with_layer_bias_correction (self, **kwargs)
 Return a copy with layer_bias_correction settings enabled.
"CompileConfig" with_mod (self, **kwargs)
 Return a copy with mod settings enabled.
"CompileConfig" with_llm (self, **kwargs)
 Return a copy with llm settings enabled.
"CompileConfig" with_search_weight_scale (self, **kwargs)
 Return a copy with search_weight_scale settings enabled.
"CompileConfig" with_load_scale (self, **kwargs)
 Return a copy with load_scale settings enabled.
"CompileConfig" with_save_sample (self, **kwargs)
 Return a copy with save_sample settings enabled.
"CompileConfig" from_file (cls, Union[str, Path] path)
 Load config from YAML or JSON file.
"CompileConfig" from_preset (cls, str name)
 Load config from a preset.
None to_file (self, Union[str, Path] path)
 Save config to YAML or JSON file.

Static Public Attributes

 model_config
List model_paths
List calib_data_path
List save_paths
bool use_random_calib
str inference_scheme
bool cpu_offload
bool force_npu_input_reposition
bool force_npu_output_reposition
int optimize_option
int buffer_mode
Any input_shape_dict
str device = Field(default="gpu", description="Device for computation")
str dtype = Field(default="float", description="Data type for computation")
bool debug = Field(default=False, description="Enable debug mode")
bool trace = Field(default=False, description="Enable trace mode")
int image_channels
str config_version
List split_blocks
int split_parts
Uint8InputConfig uint8_input
PreprocessingConfig preprocessing = Field(default_factory=PreprocessingConfig)
ResourceManagementConfig resource_management
CalibrationConfig calibration = Field(default_factory=CalibrationConfig)
BitConfig bit = Field(default_factory=BitConfig)
HessianQuantConfig hessian_quant
LayerBiasCorrectionConfig layer_bias_correction
ModConfig mod = Field(default_factory=ModConfig)
LlmConfig llm = Field(default_factory=LlmConfig)
MoeConfig moe = Field(default_factory=MoeConfig)
EquivalentTransformationConfig equivalent_transformation
SearchWeightScaleConfig search_weight_scale
LoadScaleConfig load_scale
RuntimeOptions runtime_options
SaveSampleConfig save_sample

Static Protected Member Functions

dict _flatten_grouped_json (dict data)
 Flatten grouped JSON keys (e.g.
dict _group_to_json (dict data)
 Group flat keys back into nested JSON structure (inverse of _flatten_grouped_json).

Detailed Description

Unified compilation configuration for Mobilint MXQ compilation.

Definition at line 1848 of file models.py.

Member Function Documentation

◆ with_uint8_input()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_uint8_input ( self,
** kwargs )

Return a copy with uint8_input settings enabled.

Definition at line 1960 of file models.py.

◆ with_preprocessing()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_preprocessing ( self,
** kwargs )

Return a copy with preprocessing settings enabled.

Definition at line 1966 of file models.py.

◆ with_hessian_quant()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_hessian_quant ( self,
** kwargs )

Return a copy with hessian_quant settings enabled.

Definition at line 1972 of file models.py.

◆ with_layer_bias_correction()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_layer_bias_correction ( self,
** kwargs )

Return a copy with layer_bias_correction settings enabled.

Definition at line 1978 of file models.py.

◆ with_mod()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_mod ( self,
** kwargs )

Return a copy with mod settings enabled.

Definition at line 1984 of file models.py.

◆ with_llm()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_llm ( self,
** kwargs )

Return a copy with llm settings enabled.

Definition at line 1990 of file models.py.

◆ with_search_weight_scale()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_search_weight_scale ( self,
** kwargs )

Return a copy with search_weight_scale settings enabled.

Definition at line 1996 of file models.py.

◆ with_load_scale()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_load_scale ( self,
** kwargs )

Return a copy with load_scale settings enabled.

Definition at line 2002 of file models.py.

◆ with_save_sample()

"CompileConfig" qbcompiler.configs.models.CompileConfig.with_save_sample ( self,
** kwargs )

Return a copy with save_sample settings enabled.

Definition at line 2008 of file models.py.

◆ from_file()

"CompileConfig" qbcompiler.configs.models.CompileConfig.from_file ( cls,
Union[str, Path] path )

Load config from YAML or JSON file.

Definition at line 2021 of file models.py.

◆ _flatten_grouped_json()

dict qbcompiler.configs.models.CompileConfig._flatten_grouped_json ( dict data)
staticprotected

Flatten grouped JSON keys (e.g.

quantization.calibration) to flat structure.

Definition at line 2033 of file models.py.

◆ from_preset()

"CompileConfig" qbcompiler.configs.models.CompileConfig.from_preset ( cls,
str name )

Load config from a preset.

Definition at line 2059 of file models.py.

◆ _group_to_json()

dict qbcompiler.configs.models.CompileConfig._group_to_json ( dict data)
staticprotected

Group flat keys back into nested JSON structure (inverse of _flatten_grouped_json).

Definition at line 2066 of file models.py.

◆ to_file()

None qbcompiler.configs.models.CompileConfig.to_file ( self,
Union[str, Path] path )

Save config to YAML or JSON file.

Definition at line 2099 of file models.py.

Member Data Documentation

◆ model_config

qbcompiler.configs.models.CompileConfig.model_config
static
Initial value:
= ConfigDict(
populate_by_name=True,
extra="forbid",
)

Definition at line 1851 of file models.py.

◆ model_paths

List qbcompiler.configs.models.CompileConfig.model_paths
static
Initial value:
= Field(
default=[], alias="modelPaths", description="Paths to model files"
)

Definition at line 1856 of file models.py.

◆ calib_data_path

List qbcompiler.configs.models.CompileConfig.calib_data_path
static
Initial value:
= Field(
default=[], alias="calibDataPaths", description="Paths to calibration datasets"
)

Definition at line 1859 of file models.py.

◆ save_paths

List qbcompiler.configs.models.CompileConfig.save_paths
static
Initial value:
= Field(
default=["./tmp.mxq"],
alias="savePaths",
description="Output MXQ filename/paths",
)

Definition at line 1862 of file models.py.

◆ use_random_calib

bool qbcompiler.configs.models.CompileConfig.use_random_calib
static
Initial value:
= Field(
default=False, alias="useRandomCalib", description="Use random calibration"
)

Definition at line 1867 of file models.py.

◆ inference_scheme

str qbcompiler.configs.models.CompileConfig.inference_scheme
static
Initial value:
= Field(
default="single", alias="inferenceScheme", description="NPU inference scheme"
)

Definition at line 1870 of file models.py.

◆ cpu_offload

bool qbcompiler.configs.models.CompileConfig.cpu_offload
static
Initial value:
= Field(
default=False,
alias="cpuOffload",
description="Enable CPU offload for unsupported operators",
)

Definition at line 1873 of file models.py.

◆ force_npu_input_reposition

bool qbcompiler.configs.models.CompileConfig.force_npu_input_reposition
static
Initial value:
= Field(
default=False,
alias="forceNpuInputReposition",
description="Force input reposition operations to run on NPU instead of CPU",
)

Definition at line 1878 of file models.py.

◆ force_npu_output_reposition

bool qbcompiler.configs.models.CompileConfig.force_npu_output_reposition
static
Initial value:
= Field(
default=False,
alias="forceNpuOutputReposition",
description="Force output reposition operations to run on NPU instead of CPU",
)

Definition at line 1883 of file models.py.

◆ optimize_option

int qbcompiler.configs.models.CompileConfig.optimize_option
static
Initial value:
= Field(
default=1,
alias="optimizeOption",
description="Compiler optimization selector",
ge=0,
)

Definition at line 1888 of file models.py.

◆ buffer_mode

int qbcompiler.configs.models.CompileConfig.buffer_mode
static
Initial value:
= Field(
default=1, alias="bufferMode", description="Buffer serialization mode"
)

Definition at line 1894 of file models.py.

◆ input_shape_dict

Any qbcompiler.configs.models.CompileConfig.input_shape_dict
static
Initial value:
= Field(
default={}, alias="inputShapeDict", description="Dictionary of input shapes"
)

Definition at line 1897 of file models.py.

◆ device

str qbcompiler.configs.models.CompileConfig.device = Field(default="gpu", description="Device for computation")
static

Definition at line 1900 of file models.py.

◆ dtype

str qbcompiler.configs.models.CompileConfig.dtype = Field(default="float", description="Data type for computation")
static

Definition at line 1901 of file models.py.

◆ debug

bool qbcompiler.configs.models.CompileConfig.debug = Field(default=False, description="Enable debug mode")
static

Definition at line 1902 of file models.py.

◆ trace

bool qbcompiler.configs.models.CompileConfig.trace = Field(default=False, description="Enable trace mode")
static

Definition at line 1903 of file models.py.

◆ image_channels

int qbcompiler.configs.models.CompileConfig.image_channels
static
Initial value:
= Field(
default=0,
alias="imageChannels",
description="Number of image channels (0 for auto-detect)",
)

Definition at line 1904 of file models.py.

◆ config_version

str qbcompiler.configs.models.CompileConfig.config_version
static
Initial value:
= Field(
default="1.0.0", alias="configVersion", description="Config schema version"
)

Definition at line 1909 of file models.py.

◆ split_blocks

List qbcompiler.configs.models.CompileConfig.split_blocks
static
Initial value:
= Field(
default=[],
alias="splitBlocks",
description="Multi-MXQ split points by transformer block index",
)

Definition at line 1912 of file models.py.

◆ split_parts

int qbcompiler.configs.models.CompileConfig.split_parts
static
Initial value:
= Field(
default=0,
alias="splitParts",
description="Evenly split transformer blocks into N MXQ parts",
)

Definition at line 1917 of file models.py.

◆ uint8_input

Uint8InputConfig qbcompiler.configs.models.CompileConfig.uint8_input
static
Initial value:
= Field(
default_factory=Uint8InputConfig, alias="uint8Input"
)

Definition at line 1923 of file models.py.

◆ preprocessing

PreprocessingConfig qbcompiler.configs.models.CompileConfig.preprocessing = Field(default_factory=PreprocessingConfig)
static

Definition at line 1926 of file models.py.

◆ resource_management

ResourceManagementConfig qbcompiler.configs.models.CompileConfig.resource_management
static
Initial value:
= Field(
default_factory=ResourceManagementConfig, alias="resourceManagement"
)

Definition at line 1927 of file models.py.

◆ calibration

CalibrationConfig qbcompiler.configs.models.CompileConfig.calibration = Field(default_factory=CalibrationConfig)
static

Definition at line 1930 of file models.py.

◆ bit

BitConfig qbcompiler.configs.models.CompileConfig.bit = Field(default_factory=BitConfig)
static

Definition at line 1931 of file models.py.

◆ hessian_quant

HessianQuantConfig qbcompiler.configs.models.CompileConfig.hessian_quant
static
Initial value:
= Field(
default_factory=HessianQuantConfig, alias="hessianQuant"
)

Definition at line 1932 of file models.py.

◆ layer_bias_correction

LayerBiasCorrectionConfig qbcompiler.configs.models.CompileConfig.layer_bias_correction
static
Initial value:
= Field(
default_factory=LayerBiasCorrectionConfig, alias="layerBiasCorrection"
)

Definition at line 1935 of file models.py.

◆ mod

ModConfig qbcompiler.configs.models.CompileConfig.mod = Field(default_factory=ModConfig)
static

Definition at line 1938 of file models.py.

◆ llm

LlmConfig qbcompiler.configs.models.CompileConfig.llm = Field(default_factory=LlmConfig)
static

Definition at line 1939 of file models.py.

◆ moe

MoeConfig qbcompiler.configs.models.CompileConfig.moe = Field(default_factory=MoeConfig)
static

Definition at line 1940 of file models.py.

◆ equivalent_transformation

EquivalentTransformationConfig qbcompiler.configs.models.CompileConfig.equivalent_transformation
static
Initial value:
= Field(
default_factory=EquivalentTransformationConfig, alias="equivalentTransformation"
)

Definition at line 1941 of file models.py.

◆ search_weight_scale

SearchWeightScaleConfig qbcompiler.configs.models.CompileConfig.search_weight_scale
static
Initial value:
= Field(
default_factory=SearchWeightScaleConfig, alias="searchWeightScale"
)

Definition at line 1944 of file models.py.

◆ load_scale

LoadScaleConfig qbcompiler.configs.models.CompileConfig.load_scale
static
Initial value:
= Field(
default_factory=LoadScaleConfig, alias="loadScale"
)

Definition at line 1947 of file models.py.

◆ runtime_options

RuntimeOptions qbcompiler.configs.models.CompileConfig.runtime_options
static
Initial value:
= Field(
default_factory=RuntimeOptions, alias="runtimeOptions"
)

Definition at line 1950 of file models.py.

◆ save_sample

SaveSampleConfig qbcompiler.configs.models.CompileConfig.save_sample
static
Initial value:
= Field(
default_factory=SaveSampleConfig, alias="saveSample"
)

Definition at line 1953 of file models.py.


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