{"record":{"id":"d6de259fb16ac9f3","repo":"microsoft/VibeVoice","slug":"prediction-type-prediction-type-not-implemented","errorCode":null,"errorMessage":"Prediction type {prediction_type} not implemented","messagePattern":"Prediction type (.+?) not implemented","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"vibevoice/modular/modeling_vibevoice.py","lineNumber":457,"sourceCode":"            noisy_speech_features = self.model.noise_scheduler.add_noise(\n                speech_features_repeated, noise, timesteps\n            )\n            \n            model_output = self.model.prediction_head(\n                noisy_speech_features, \n                timesteps.type_as(x), \n                condition_features_repeated\n            )\n\n            prediction_type = self.config.diffusion_head_config.prediction_type\n            if prediction_type == \"epsilon\":\n                target_for_loss = noise\n            elif prediction_type == \"v_prediction\":\n                target_for_loss = self.model.noise_scheduler.get_velocity(\n                    speech_features_repeated, noise, timesteps\n                )\n            else:\n                raise NotImplementedError(f\"Prediction type {prediction_type} not implemented\")\n\n            diffusion_loss = F.mse_loss(model_output.float(), target_for_loss.float(), reduction='sum')\n            if latent_size > 0 and ddpm_batch_mul > 0:\n                diffusion_loss = diffusion_loss / latent_size / ddpm_batch_mul\n            else:\n                diffusion_loss = torch.tensor(0.0, device=diffusion_loss.device)\n        \n        else:\n            # Dummy loss for DDP to work when there are no speech samples in a batch,\n            # but we are in a speech context.\n            diffusion_loss = sum(p.sum() for p in self.model.prediction_head.parameters()) * 0.0\n            diffusion_loss += sum(p.sum() for p in self.model.acoustic_connector.parameters()) * 0.0\n            diffusion_loss += sum(p.sum() for p in self.model.semantic_connector.parameters()) * 0.0\n        # --- End Diffusion Loss Calculation ---\n\n        if not return_dict:\n            output = (logits, speech_len) + outputs.to_tuple()[1:]\n            return (loss, diffusion_loss) + output","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/modular/modeling_vibevoice.py#L439-L475","documentation":"The diffusion training loss in modeling_vibevoice.py supports only prediction_type 'epsilon' and 'v_prediction' (read from config.diffusion_head_config.prediction_type); any other value raises NotImplementedError when computing the denoising target. This mirrors the standard diffusers DDPM contract.","triggerScenarios":"Training with diffusion_head_config.prediction_type set to 'sample', 'sample_prediction', or an empty/typo value; loading a checkpoint whose diffusion head config carries an unsupported prediction type.","commonSituations":"Copy-pasting scheduler settings from a diffusers pipeline that uses 'sample'; fine-tunes editing diffusion_head_config; older config files with a different key name defaulting to None.","solutions":["Set diffusion_head_config.prediction_type to 'epsilon' or 'v_prediction' in the config used for training.","Inspect checkpoint config.json: diffusion_head_config.prediction_type must be one of the two values.","If 'sample' prediction is required, implement the target = speech_features_repeated branch before the raise.","Add a startup assert validating prediction_type against the supported set."],"exampleFix":"# before\ncfg.diffusion_head_config.prediction_type = \"sample\"  # -> NotImplementedError\n\n# after\ncfg.diffusion_head_config.prediction_type = \"v_prediction\"","handlingStrategy":"validation","validationCode":"pt = config.diffusion_head_config.prediction_type\nassert pt in {\"epsilon\", \"v_prediction\"}, f\"Unsupported prediction_type {pt!r}\"","typeGuard":"def is_supported_prediction_type(pt: object) -> bool:\n    return pt in (\"epsilon\", \"v_prediction\")","tryCatchPattern":"try:\n    loss = trainer_step(...)\nexcept NotImplementedError as e:\n    raise SystemExit(f\"Fix diffusion config: {e}\") from e","preventionTips":["Validate prediction_type at training startup","Only copy scheduler settings from diffusers configs you understand","Keep a golden config.json per training recipe"],"tags":["training","diffusion","prediction-type","config","notimplementederror"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}