{"record":{"id":"93a8b3354a5de951","repo":"sgl-project/sglang","slug":"teacache-is-not-supported-yet-for-hunyuanvideo","errorCode":null,"errorMessage":"teacache is not supported yet for HunyuanVideo","messagePattern":"teacache is not supported yet for HunyuanVideo","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/hunyuanvideo.py","lineNumber":959,"sourceCode":"\n        return img\n\n    def maybe_cache_states(\n        self, hidden_states: torch.Tensor, original_hidden_states: torch.Tensor\n    ) -> None:\n        self.previous_residual = hidden_states - original_hidden_states\n\n    def should_skip_forward_for_cached_states(self, **kwargs) -> bool:\n        forward_context = get_forward_context()\n        forward_batch = forward_context.forward_batch\n        if forward_batch is None:\n            return False\n        current_timestep = forward_context.current_timestep\n        enable_teacache = forward_batch.enable_teacache\n\n        if not enable_teacache:\n            return False\n        raise NotImplementedError(\"teacache is not supported yet for HunyuanVideo\")\n\n        teacache_params = forward_batch.teacache_params\n        assert teacache_params is not None, \"teacache_params is not initialized\"\n        assert isinstance(\n            teacache_params, TeaCacheParams\n        ), \"teacache_params is not a TeaCacheParams\"\n        num_inference_steps = forward_batch.num_inference_steps\n        teache_thresh = teacache_params.teacache_thresh\n\n        coefficients = teacache_params.coefficients\n\n        if current_timestep == 0:\n            self.cnt = 0\n\n        inp = kwargs[\"img\"].clone()\n        vec_ = kwargs[\"vec\"].clone()\n        # convert to DTensor\n        vec_ = torch.distributed.tensor.DTensor.from_local(","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/hunyuanvideo.py#L941-L977","documentation":"HunyuanVideo's should_skip_forward_for_cached_states returns False when TeaCache is disabled, but if forward_batch.enable_teacache is True it raises NotImplementedError — TeaCache acceleration has simply not been implemented for this model yet (the code after the raise is dead/placeholder).","triggerScenarios":"Running HunyuanVideo inference with the teacache flag enabled (forward_batch.enable_teacache=True), e.g. passing --enable-teacache or the equivalent server/runtime option.","commonSituations":"Copying launch flags from other DiT models that do support TeaCache; enabling teacache in a shared serving config that routes multiple video models.","solutions":["Disable teacache for HunyuanVideo runs (remove --enable-teacache / set enable_teacache=False)","Keep model-specific flag sets per model in your launch scripts instead of one shared flag list","Watch releases for TeaCache support landing for HunyuanVideo before re-enabling"],"exampleFix":"# before\nforward_batch.enable_teacache = True  # or --enable-teacache on server start\n\n# after\nforward_batch.enable_teacache = False  # remove the teacache flag for HunyuanVideo","handlingStrategy":"fallback","validationCode":"if forward_batch.enable_teacache and model_config.architecture == 'HunyuanVideo':\n    forward_batch.enable_teacache = False  # not supported; run without acceleration\n    logger.warning('teacache disabled: unsupported for HunyuanVideo')","typeGuard":"def model_supports_teacache(model_name: str) -> bool:\n    return model_name.lower() != 'hunyuanvideo'","tryCatchPattern":"try:\n    out = model.forward(hidden_states, forward_batch)\nexcept NotImplementedError as e:\n    if 'teacache' in str(e):\n        forward_batch.enable_teacache = False\n        out = model.forward(hidden_states, forward_batch)\n    else:\n        raise","preventionTips":["Keep per-model launch flag sets instead of shared global flags","Check the feature matrix before enabling acceleration flags on new models","Fail fast at startup on unsupported flag/model combos"],"tags":["unsupported-feature","teacache","video-diffusion","runtime"],"backgroundTag":"unsupported-feature-flag","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}