{"record":{"id":"2d223368ea4ffd2f","repo":"OpenBMB/VoxCPM","slug":"triton-is-not-installed","errorCode":null,"errorMessage":"triton is not installed","messagePattern":"triton is not installed","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/voxcpm/model/voxcpm.py","lineNumber":238,"sourceCode":"        # 投影层\n        if cfg.enable_proj:\n            from ..modules.layers.lora import LoRALinear\n\n            for attr_name in cfg.target_proj_modules:\n                module = getattr(self, attr_name, None)\n                if isinstance(module, nn.Linear):\n                    setattr(self, attr_name, LoRALinear(base=module, **lora_kwargs))\n\n    def optimize(self, disable: bool = False):\n        if disable:\n            return self\n        try:\n            if self.device != \"cuda\":\n                raise ValueError(\"VoxCPMModel can only be optimized on CUDA device\")\n            try:\n                import triton  # noqa: F401\n            except ImportError:\n                raise ValueError(\"triton is not installed\")\n            self.base_lm.forward_step = torch.compile(self.base_lm.forward_step, mode=\"reduce-overhead\", fullgraph=True)\n            self.residual_lm.forward_step = torch.compile(\n                self.residual_lm.forward_step, mode=\"reduce-overhead\", fullgraph=True\n            )\n            self._feat_encoder_raw = self.feat_encoder\n            self.feat_encoder = torch.compile(self.feat_encoder, mode=\"reduce-overhead\", fullgraph=True)\n            self.feat_decoder.estimator = torch.compile(\n                self.feat_decoder.estimator, mode=\"reduce-overhead\", fullgraph=True\n            )\n        except Exception as e:\n            print(f\"Warning: torch.compile disabled - {e}\", file=sys.stderr)\n        return self\n\n    def forward(\n        self,\n        text_tokens: torch.Tensor,\n        text_mask: torch.Tensor,\n        audio_feats: torch.Tensor,","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/OpenBMB/VoxCPM/blob/f5a1c6a6b901bc732e20f0d59a369f6829ad717a/src/voxcpm/model/voxcpm.py#L220-L256","documentation":"optimize() depends on triton for compiled kernels; if the import fails on a CUDA setup, it raises ValueError('triton is not installed') from the ImportError.","triggerScenarios":"Enabling optimize=True on CUDA where triton is absent — e.g. torch installed without the bundled triton, or an env where triton was uninstalled/pinned out.","commonSituations":"Slim Docker images, conda envs with mismatched torch/triton versions, or triton lacking support for the platform (e.g. Windows without a triton build).","solutions":["pip install triton (version matching your torch/CUDA)","Install torch via a CUDA bundle that ships triton","If triton can't be supported on your platform, keep optimize=False"],"exampleFix":"# before\n# optimize=True with no triton\npip install triton\n# after\nmodel = VoxCPM(arch=\"v1\", device=\"cuda\", optimize=True)  # now works","handlingStrategy":"fallback","validationCode":"try:\n    import triton  # noqa\n    has_triton = True\nexcept ImportError:\n    has_triton = False\noptimize = optimize and has_triton","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include triton in GPU Docker images","Pin torch/triton versions together"],"tags":["triton","missing-dependency","optimization"],"backgroundTag":"missing-dependency","analyzedSha":"f5a1c6a6b901bc732e20f0d59a369f6829ad717a","analyzedAt":"2026-08-27T05:54:30.617Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}