{"record":{"id":"2c461c08a3c241be","repo":"OpenBMB/VoxCPM","slug":"retry-on-bad-cases-is-not-supported-in-streaming-m","errorCode":null,"errorMessage":"Retry on bad cases is not supported in streaming mode, setting retry_badcase=False.","messagePattern":"Retry on bad cases is not supported in streaming mode, setting retry_badcase=False\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/voxcpm/model/voxcpm.py","lineNumber":376,"sourceCode":"\n    @torch.inference_mode()\n    def _generate(\n        self,\n        target_text: str,\n        prompt_text: str = \"\",\n        prompt_wav_path: str = \"\",\n        min_len: int = 2,\n        max_len: int = 2000,\n        inference_timesteps: int = 10,\n        cfg_value: float = 2.0,\n        retry_badcase: bool = False,\n        retry_badcase_max_times: int = 3,\n        retry_badcase_ratio_threshold: float = 6.0,  # setting acceptable ratio of audio length to text length (for badcase detection)\n        streaming: bool = False,\n        seed: Optional[int] = None,\n    ) -> Generator[torch.Tensor, None, None]:\n        if retry_badcase and streaming:\n            warnings.warn(\"Retry on bad cases is not supported in streaming mode, setting retry_badcase=False.\")\n            retry_badcase = False\n        if len(prompt_wav_path) == 0:\n            text = target_text\n            text_token = torch.LongTensor(self.text_tokenizer(text))\n            text_token = torch.cat(\n                [\n                    text_token,\n                    torch.tensor(\n                        [self.audio_start_token],\n                        dtype=torch.int32,\n                        device=text_token.device,\n                    ),\n                ],\n                dim=-1,\n            )\n            text_length = text_token.shape[0]\n\n            audio_feat = torch.zeros(","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/OpenBMB/VoxCPM/blob/f5a1c6a6b901bc732e20f0d59a369f6829ad717a/src/voxcpm/model/voxcpm.py#L358-L394","documentation":"Bad-case retry re-runs generation when the audio/text length ratio looks wrong; this is impossible when chunks are already yielded in streaming mode, so voxcpm emits a UserWarning and silently forces retry_badcase=False.","triggerScenarios":"Calling generate/_generate with streaming=True and retry_badcase=True (the default), producing warnings.warn output.","commonSituations":"Service wrapping the streaming API with default args; users surprised that streamed audio can occasionally have bad length without retry.","solutions":["Explicitly pass retry_badcase=False with streaming=True to silence the warning and document intent","If bad-case protection matters, use non-streaming generate with retry_badcase=True","Filter/handle the UserWarning at the call site if noise matters"],"exampleFix":"# before\nfor chunk in model.generate_streaming(text, ...):\n    ...\n# after\nfor chunk in model._generate(..., streaming=True, retry_badcase=False):\n    ...","handlingStrategy":"validation","validationCode":"if streaming:\n    retry_badcase = False  # avoid the warning and be explicit","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass retry_badcase=False explicitly with streaming APIs","Monitor output quality separately when streaming since retries are off"],"tags":["streaming","tts","warnings","badcase-retry"],"backgroundTag":"unsupported-option-combination","analyzedSha":"f5a1c6a6b901bc732e20f0d59a369f6829ad717a","analyzedAt":"2026-08-27T05:54:30.617Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}