Skip to content

qbcompiler.configs.presets

Auto-generated preset definitions from config_schema.yaml.

Attributes

Name Description
PRESETS

PRESETS

PRESETS: Dict[str, dict] = {
    "classification": {
        "description": "Image classification models (ResNet, EfficientNet, ViT, etc.)",
        "config": {"calibration": {"mode": 1, "output": 0}},
    },
    "detection": {
        "description": "Object detection models (YOLO, SSD, DETR, etc.)",
        "config": {"calibration": {"mode": 1, "output": 1}},
    },
    "classification_torchvision": {
        "description": "Torchvision classification models with standard preprocessing",
        "extends": "classification",
        "config": {
            "uint8Input": {"apply": True, "inputs": []},
            "imageChannels": 3,
            "preprocessing": {
                "apply": True,
                "autoConvertFormat": True,
                "pipeline": [
                    {"op": "resize", "size": 256, "mode": "bilinear", "backend": "pil"},
                    {"op": "centerCrop", "height": 224, "width": 224},
                    {
                        "op": "normalize",
                        "mean": [0.485, 0.456, 0.406],
                        "std": [0.229, 0.224, 0.225],
                        "scaleToUint8": True,
                        "fuseIntoFirstLayer": True,
                    },
                ],
                "inputConfigs": {},
            },
        },
    },
    "yolo_640": {
        "description": "YOLO detection models with 640x640 letterbox preprocessing",
        "extends": "detection",
        "config": {
            "uint8Input": {"apply": True, "inputs": []},
            "imageChannels": 3,
            "preprocessing": {
                "apply": True,
                "autoConvertFormat": True,
                "pipeline": [
                    {
                        "op": "letterbox",
                        "height": 640,
                        "width": 640,
                        "padValue": 114,
                        "backend": "opencv",
                    }
                ],
                "inputConfigs": {},
            },
        },
    },
    "yolo_1280": {
        "description": "YOLO detection models with 1280x1280 letterbox preprocessing",
        "extends": "detection",
        "config": {
            "uint8Input": {"apply": True, "inputs": []},
            "imageChannels": 3,
            "preprocessing": {
                "apply": True,
                "autoConvertFormat": True,
                "pipeline": [
                    {
                        "op": "letterbox",
                        "height": 1280,
                        "width": 1280,
                        "padValue": 114,
                        "backend": "opencv",
                    }
                ],
                "inputConfigs": {},
            },
        },
    },
    "llm": {
        "description": "Large Language Models (LLaMA, Qwen, Gemma, etc.)",
        "config": {
            "equivalentTransformation": {
                "QK": {"apply": True},
                "UD": {"apply": True},
                "VO": {"apply": True},
                "SpinR1": {"apply": True},
                "SpinR2": {"apply": True},
                "OptimizeFFN": {"apply": True},
            },
            "llm": {
                "apply": True,
                "attributes": {
                    "maxSequenceLength": 4096,
                    "maxCacheLength": 4096,
                    "calibration": {"useFullSeqLength": True},
                },
            },
            "calibration": {"mode": 0, "output": 0},
        },
    },
    "llm_fast": {
        "description": "LLM with faster compilation (less accuracy optimization)",
        "extends": "llm",
        "config": {
            "equivalentTransformation": {
                "QK": {"apply": False},
                "UD": {"apply": False},
                "VO": {"apply": False},
                "SpinR1": {"apply": False},
                "SpinR2": {"apply": False},
                "OptimizeFFN": {"apply": False},
            },
            "llm": {
                "apply": True,
                "attributes": {"calibration": {"useFullSeqLength": False}},
            },
        },
    },
    "vision_transformer": {
        "description": "Vision Transformer models (ViT, DeiT, Swin, etc.)",
        "config": {
            "calibration": {"method": 1, "mode": 0},
            "bit": {"transformer": {"activation": {"output": 16, "ffn": 16}}},
        },
    },
    "multimodal": {
        "description": "Multimodal models (CLIP, BLIP, LLaVA, etc.)",
        "config": {"calibration": {"method": 3}, "llm": {"apply": True}},
    },
}

Preset

class Preset

Preset utility class.

Methods

Name Description
list List available preset names.
get Get a preset by name.
describe Get preset description.

list

def list() -> List[str]

List available preset names.

get

def get(name: str) -> CompileConfig

Get a preset by name.

describe

def describe(name: str) -> str

Get preset description.

Functions

Name Description
list_presets List available preset names.
get_preset Get a CompileConfig from a preset name.

list_presets

def list_presets() -> List[str]

List available preset names.

get_preset

def get_preset(name: str) -> CompileConfig

Get a CompileConfig from a preset name.