qbcompiler.frontend.Model_Dict Class Reference

qbcompiler.frontend.Model_Dict Class Reference#

Mobilint SDK qb Compiler: qbcompiler.frontend.Model_Dict Class Reference
Mobilint SDK qb Compiler v1.0
MCS002-EN
qbcompiler.frontend.Model_Dict Class Reference

Wrapper around the Mobilint compiler to support compilation and inference workflows. More...

Inheritance diagram for qbcompiler.frontend.Model_Dict:

Public Member Functions

 __init__ (self, model, backend="onnx", device="cpu", feed_dict=None, dynamic_axes=None, in_dformats=None, yolo_decode_include=False, use_custom_mask=False, exclude_first_subgraph=False, **kwargs)
 Initialize the Mobilint compiler wrapper.
 compile (self, str calib_data_path=None, str save_path=None, int save_subgraph_type=0, output_subgraph_path="", str model_nickname=None, save_sample=False, use_random_calib=False, inference_scheme="single", cpu_offload=False, optimize_option=1, str sample_dtype="float", buffer_mode=1, compile_config=None, **kwargs)
 Compile the wrapped model into an MXQ artifact.

Detailed Description

Wrapper around the Mobilint compiler to support compilation and inference workflows.

Capabilities include:

  • Compilation of models into MXQ artifacts runnable on Mobilint NPUs.
  • Inference using the full-precision high-level compiled model on CPU or GPU.
  • Inference with the quantized model on CPU or GPU.

Definition at line 23 of file frontend.py.

Constructor & Destructor Documentation

◆ __init__()

qbcompiler.frontend.Model_Dict.__init__ ( self,
model,
backend = "onnx",
device = "cpu",
feed_dict = None,
dynamic_axes = None,
in_dformats = None,
yolo_decode_include = False,
use_custom_mask = False,
exclude_first_subgraph = False,
** kwargs )

Initialize the Mobilint compiler wrapper.

Parameters
modelstring or model instance. Model path or in-memory model to compile.
backendstring. Framework identifier for the model (for example "onnx"). Defaults to "onnx".
devicestring. Target device for inference ("cpu" or "gpu"). Defaults to "cpu".
feed_dictdict. Example inputs for shape resolution.
dynamic_axesdict. Marks model axes as dynamic.
in_dformatsdict. Describes input data formats.
yolo_decode_includebool. Runs YOLO decode on NPU when True.
use_custom_maskbool. For non-LLM models that include a mask, use a custom mask provided as a separate input instead of the causal mask.
exclude_first_subgraphbool. Applies only when CPU offloading is enabled: exclude the first subgraph from the final graph if it is unsupported.
kwargsdict. Additional compiler arguments.

Definition at line 33 of file frontend.py.

Member Function Documentation

◆ compile()

qbcompiler.frontend.Model_Dict.compile ( self,
str calib_data_path = None,
str save_path = None,
int save_subgraph_type = 0,
output_subgraph_path = "",
str model_nickname = None,
save_sample = False,
use_random_calib = False,
inference_scheme = "single",
cpu_offload = False,
optimize_option = 1,
str sample_dtype = "float",
buffer_mode = 1,
compile_config = None,
** kwargs )

Compile the wrapped model into an MXQ artifact.

Parameters
calib_data_pathstring. Calibration dataset directory or meta file (.txt/.json) listing NumPy samples.
save_pathstring. Output MXQ filename.
save_subgraph_typeint. Controls optional MBLT exports: 0 disables; 1 saves graph structure; 2 saves structure and weights; 3 splits structure into multiple subgraphs; 4 splits structure and weights.
output_subgraph_pathstring. Destination for exported .mblt when save_subgraph_type is 1–4.
model_nicknamestring. Friendly name stored in qbcompiler for faster recompile.
save_samplebool. Persists inputs/outputs for debugging in ./sampleInOut.
use_random_calibbool. Uses randomly generated calibration samples when True.
inference_schemestring. NPU inference configuration ("single", "multi", "global", etc.).
cpu_offloadbool. Enables CPU offload for unsupported groups.
optimize_optionint. Compiler optimization selector.
sample_dtypestring. Data type used for saved sample outputs.
buffer_modeint. Buffer serialization mode (0 naive, 1 mmap).
compile_configCompileConfig. Compile configuration object.
kwargsdict. Additional arguments forwarded to the compiler.

Definition at line 73 of file frontend.py.


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