{"record":{"id":"7a91c6a95c88c2a3","repo":"microsoft/VibeVoice","slug":"unified-forward-is-disabled-use-forward-lm-fo","errorCode":null,"errorMessage":"Unified forward is disabled. Use `forward_lm`, `forward_tts_lm`, or `generate` instead.","messagePattern":"Unified forward is disabled\\. Use `forward_lm`, `forward_tts_lm`, or `generate` instead\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"vibevoice/modular/modeling_vibevoice_streaming_inference.py","lineNumber":494,"sourceCode":"        )\n\n    def forward(self, *args, **kwargs):\n        \"\"\"\n        Unified forward is intentionally disabled.\n\n        Reasons:\n          1. The inference pipeline is staged: base text LM, then TTS LM, plus streaming & diffusion handled in `generate`.\n          2. A monolithic call would hide required sequencing (prefill, window stepping, speech diffusion sampling).\n\n        Use instead:\n          - self.forward_lm(...)       for a base text LM step (prefill or incremental).\n          - self.forward_tts_lm(...)   for a single TTS LM step (needs LM hidden states).\n          - self.generate(...)         for full streaming (text + speech + diffusion + audio assembly).\n\n        Raises:\n            RuntimeError: Always (by design).\n        \"\"\"\n        raise RuntimeError(\n            \"Unified forward is disabled. Use `forward_lm`, `forward_tts_lm`, or `generate` instead.\"\n        )\n\n    def _build_generate_config_model_kwargs(self, generation_config, inputs, tokenizer, return_processors=False, **kwargs):\n        if generation_config is None:\n            generation_config = GenerationConfig(\n                bos_token_id=tokenizer.bos_token_id,\n                eos_token_id=tokenizer.eos_token_id,\n                pad_token_id = tokenizer.pad_token_id\n            )\n        else:\n            generation_config = GenerationConfig(\n                **generation_config,\n                bos_token_id=tokenizer.bos_token_id,\n                eos_token_id=tokenizer.eos_token_id,\n                pad_token_id = tokenizer.pad_token_id\n            )\n","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/modular/modeling_vibevoice_streaming_inference.py#L476-L512","documentation":"The streaming inference wrapper disables unified forward on purpose: generation is staged (base text LM prefill, windowed TTS LM stepping, diffusion sampling, audio assembly) and a single forward call would hide the required sequencing. Any model(...) call raises RuntimeError pointing to forward_lm, forward_tts_lm, or generate.","triggerScenarios":"Calling inference_model(inputs) or inference_model.forward(...); passing the wrapper to libraries that call module(*args) (accelerate, torch.compile entry, generic serving harnesses).","commonSituations":"Migrating code from the non-streaming model that had a working forward; generic inference servers that just call model(batch); notebook usage copy-pasted from standard transformers examples.","solutions":["Use model.generate(...) for full streaming text+speech generation.","Use model.forward_lm(...) / model.forward_tts_lm(...) for the individual staged steps.","Wrap the staged calls in your own function if a callable interface is needed by external tooling.","Read the docstring at modeling_vibevoice_streaming_inference.py:494 for the intended sequencing before writing custom loops."],"exampleFix":"# before\noutputs = inference_model(input_ids=ids)  # RuntimeError\n\n# after\noutputs = inference_model.generate(input_ids=ids, ...)  # full streaming pipeline","handlingStrategy":"type-guard","validationCode":"def run_generation(model, **kwargs):\n    # unified forward is disabled on the streaming inference wrapper\n    return model.generate(**kwargs)","typeGuard":"def is_streaming_inference_wrapper(model) -> bool:\n    return hasattr(model, \"forward_lm\") and hasattr(model, \"forward_tts_lm\") and hasattr(model, \"generate\")","tryCatchPattern":"try:\n    out = model(input_ids=ids)\nexcept RuntimeError as e:\n    if \"forward is disabled\" in str(e):\n        out = model.generate(input_ids=ids)\n    else:\n        raise","preventionTips":["Use generate() for full streaming inference","Call forward_lm/forward_tts_lm only for staged custom loops","Keep generic serving harnesses away from direct module calls on this wrapper"],"tags":["api-contract","streaming","inference","forward-disabled","runtimeerror"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}