{"record":{"id":"08eb57d85e8f0e6d","repo":"sgl-project/sglang","slug":"quant-videogen-kv-cache-quantization-requires-its","errorCode":null,"errorMessage":"Quant-VideoGen KV-cache quantization requires its optional runtime dependencies. Install them with: pip install 'sglang[diffusion-qvg]' && pip install --no-deps quant-videogen==0.1.0.","messagePattern":"Quant-VideoGen KV-cache quantization requires its optional runtime dependencies\\. Install them with: pip install 'sglang\\[diffusion-qvg\\]' && pip install --no-deps quant-videogen==0\\.1\\.0\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/kvcache/qvg_packed_cache.py","lineNumber":49,"sourceCode":"\nfrom sglang.multimodal_gen.configs.quantization.qvg_kv import QVGKVQuantArgs\nfrom sglang.multimodal_gen.runtime.layers.kvcache.causal_attention_cache import (\n    CausalAttentionKVView,\n)\nfrom sglang.multimodal_gen.runtime.utils.logging_utils import init_logger\n\nlogger = init_logger(__name__)\n\n\n@cache\ndef _qvg_functions():\n    try:\n        from quant_videogen.functions import (\n            triton_prq_dequantize_tensor,\n            triton_prq_quantize_tensor,\n        )\n    except ImportError as e:\n        raise ImportError(\n            \"Quant-VideoGen KV-cache quantization requires its optional \"\n            \"runtime dependencies. Install them with: \"\n            \"pip install 'sglang[diffusion-qvg]' && \"\n            \"pip install --no-deps quant-videogen==0.1.0.\"\n        ) from e\n    return triton_prq_quantize_tensor, triton_prq_dequantize_tensor\n\n\n@dataclass\nclass _Segment:\n    g0: int  # global start token (inclusive)\n    g1: int  # global end token (exclusive)\n    is_sink: bool  # sink segments are never evicted\n    k: torch.Tensor | None = None\n    v: torch.Tensor | None = None\n    packed_k: dict | None = None\n    packed_v: dict | None = None\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/kvcache/qvg_packed_cache.py#L31-L67","documentation":"QVG-packed quantized KV cache lazily imports triton_prq_quantize_tensor/triton_prq_dequantize_tensor from quant_videogen. If that optional package (or its functions module) is absent, this ImportError tells you exactly how to install the extras.","triggerScenarios":"Constructing or running QVGPackedCausalKVCache with quantization enabled (invokes _pack/_dequant -> _qvg_functions) when `import quant_videogen.functions` fails.","commonSituations":"Base sglang install without the diffusion-qvg extra; quant-videogen installed with conflicting deps so --no-deps is required; version drift where quant-videogen != 0.1.0 lacks the functions module.","solutions":["pip install 'sglang[diffusion-qvg]'","pip install --no-deps quant-videogen==0.1.0","Verify with: python -c \"from quant_videogen.functions import triton_prq_quantize_tensor\"","If you don't need packed KV quant, disable it and use the bf16 packed cache"],"exampleFix":"# before: ImportError at runtime\n# after\npip install 'sglang[diffusion-qvg]' && pip install --no-deps quant-videogen==0.1.0","handlingStrategy":"fallback","validationCode":"try:\\n    from quant_videogen.functions import triton_prq_quantize_tensor  # noqa\n    qvg_available = True\nexcept ImportError:\n    qvg_available = False","typeGuard":null,"tryCatchPattern":"try:\\n    cache = QVGPackedCausalKVCache(..., quant=True)\\nexcept ImportError:\\n    cache = PackedCausalKVCache(...)  # bf16 fallback","preventionTips":["Install extras at image build time, not lazily in prod","Gate quant features on an availability probe","Pin quant-videogen==0.1.0 with --no-deps"],"tags":["missing-dependency","optional-extra","kv-cache","quantization","pip-install"],"backgroundTag":"missing-optional-dependency","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}