콘텐츠로 이동

qbcompiler.configs.resource_management_config

ResourceManagementConfig

class ResourceManagementConfig(ConfigABC)

Configuration for resource management during model compilation.

Attributes

Name Description
optional
DEFAULTS
py_to_cpp_name
min_max_check
weight_memory_methods

optional

optional = False

DEFAULTS

DEFAULTS = {
    "weight_dtype": "float32",
    "use_gpu_only_for_calibration": True,
    "weight_memory_method": 0,
}

py_to_cpp_name

py_to_cpp_name = {
    "weight_dtype": "weightDtype",
    "use_gpu_only_for_calibration": "useGPUOnlyForCalibration",
    "weight_memory_method": "weightMemoryMethod",
}

min_max_check

min_max_check = {
    "weight_memory_method": [0, 4],
}

weight_memory_methods

weight_memory_methods = [
    "DeleteFloat",
    "SaveFloat",
    "MoveFloat",
    "KeepFloat",
    "KeepAll",
]

Methods

Name Description
__init__ Initialize the ResourceManagementConfig.
default_config
from_kwargs
from_dict Create ResourceManagementConfig from dictionary (JSON structure)
to_dict

__init__

def __init__(
    self,
    weight_dtype: str,
    use_gpu_only_for_calibration: bool,
    weight_memory_method: int,
    optional: bool = optional,
)

Initialize the ResourceManagementConfig.

Parameters

  • weight_dtype — str. Weight data type for calibration (e.g., "float32", "float16").
  • use_gpu_only_for_calibration — bool. If True, use GPU only during the calibration phase.
  • weight_memory_method — int. Weight memory management method index.
    0: DeleteFloat - Delete float weights after quantization.
    1: SaveFloat - Save float weights to disk.
    2: MoveFloat - Move float weights to CPU.
    3: KeepFloat - Keep float weights in memory.
    4: KeepAll - Keep all weights in memory.
  • optional — bool. Indicates whether this config is optional. Use the default value defined as a class variable.

default_config

def default_config(cls)

from_kwargs

def from_kwargs(cls, **kwargs)

from_dict

def from_dict(cls, config_dict: dict)

Create ResourceManagementConfig from dictionary (JSON structure)

to_dict

def to_dict(self)

Functions

Name Description
get_resource_management_config Create ResourceManagementConfig with partial parameters merged with defaults.

get_resource_management_config

def get_resource_management_config(**kwargs) -> ResourceManagementConfig

Create ResourceManagementConfig with partial parameters merged with defaults.