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.1
MCS002-EN
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_optq (self, **kwargs)
 Return a copy with optq 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_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
Optional save_msgpack_name
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)
OptqConfig optq = Field(default_factory=OptqConfig)
ModConfig mod = Field(default_factory=ModConfig)
LlmConfig llm = Field(default_factory=LlmConfig)
EquivalentTransformationConfig equivalent_transformation
SearchWeightScaleConfig search_weight_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 1435 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 1540 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 1546 of file models.py.

◆ with_optq()

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

Return a copy with optq settings enabled.

Definition at line 1552 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 1558 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 1564 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 1570 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 1576 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 1583 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 1595 of file models.py.

◆ from_preset()

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

Load config from a preset.

Definition at line 1617 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 1624 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 1651 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 1438 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 1443 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 1446 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 1449 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 1454 of file models.py.

◆ save_msgpack_name

Optional qbcompiler.configs.models.CompileConfig.save_msgpack_name
static
Initial value:
= Field(
default=None,
alias="saveMsgpackName",
description="Name of the msgpack file to save",
)

Definition at line 1457 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 1462 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 1465 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 1470 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 1475 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 1480 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 1486 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 1489 of file models.py.

◆ device

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

Definition at line 1492 of file models.py.

◆ dtype

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

Definition at line 1493 of file models.py.

◆ debug

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

Definition at line 1494 of file models.py.

◆ trace

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

Definition at line 1495 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 1496 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 1501 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 1504 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 1509 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 1515 of file models.py.

◆ preprocessing

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

Definition at line 1518 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 1519 of file models.py.

◆ calibration

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

Definition at line 1522 of file models.py.

◆ bit

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

Definition at line 1523 of file models.py.

◆ optq

OptqConfig qbcompiler.configs.models.CompileConfig.optq = Field(default_factory=OptqConfig)
static

Definition at line 1524 of file models.py.

◆ mod

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

Definition at line 1525 of file models.py.

◆ llm

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

Definition at line 1526 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 1527 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 1530 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 1533 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 1536 of file models.py.


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