{"record":{"id":"e94c07f9cf2b4dfd","repo":"microsoft/VibeVoice","slug":"missing-sample-as-a-required-keyword-argument","errorCode":null,"errorMessage":"missing `sample` as a required keyword argument","messagePattern":"missing `sample` as a required keyword argument","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vibevoice/schedule/dpm_solver.py","lineNumber":562,"sourceCode":"\n        </Tip>\n\n        Args:\n            model_output (`torch.Tensor`):\n                The direct output from the learned diffusion model.\n            sample (`torch.Tensor`):\n                A current instance of a sample created by the diffusion process.\n\n        Returns:\n            `torch.Tensor`:\n                The converted model output.\n        \"\"\"\n        timestep = args[0] if len(args) > 0 else kwargs.pop(\"timestep\", None)\n        if sample is None:\n            if len(args) > 1:\n                sample = args[1]\n            else:\n                raise ValueError(\"missing `sample` as a required keyword argument\")\n        if timestep is not None:\n            deprecate(\n                \"timesteps\",\n                \"1.0.0\",\n                \"Passing `timesteps` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`\",\n            )\n\n        # DPM-Solver++ needs to solve an integral of the data prediction model.\n        if self.config.algorithm_type in [\"dpmsolver++\", \"sde-dpmsolver++\"]:\n            if self.config.prediction_type == \"epsilon\":\n                # DPM-Solver and DPM-Solver++ only need the \"mean\" output.\n                if self.config.variance_type in [\"learned\", \"learned_range\"]:\n                    model_output = model_output[:, :3]\n                sigma = self.sigmas[self.step_index]\n                alpha_t, sigma_t = self._sigma_to_alpha_sigma_t(sigma)\n                x0_pred = (sample - sigma_t * model_output) / alpha_t\n            elif self.config.prediction_type == \"sample\":\n                x0_pred = model_output","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/schedule/dpm_solver.py#L544-L580","documentation":"Internal helper `_convert_model_output` requires the current `sample` tensor to convert the model output into x0/epsilon predictions, but supports legacy positional/keyword calling conventions: it looks for `sample` as a keyword arg, else as args[1], else raises. This error means you called the internal API directly (or via a subclass) without the sample tensor. Normal users never hit it — `scheduler.step()` always forwards sample.","triggerScenarios":"Calling `scheduler._convert_model_output(model_output, timestep)` without `sample=...`, e.g. from custom sampling code or a scheduler subclass that overrides step() and forwards args incompletely.","commonSituations":"Writing a custom multistep sampler that reuses the conversion helper; subclassing the scheduler for vibevoice batched/audio tokens and dropping the sample argument in the super() call.","solutions":["Pass the sample explicitly: `scheduler._convert_model_output(model_output, sample=sample)`.","Better: don't call the helper directly — call `scheduler.step(model_output, timestep, sample)` which handles conversion, stepping, and counter updates.","In subclasses, forward `*args, **kwargs` intact to super()."],"exampleFix":"# before\nx0 = scheduler._convert_model_output(model_output, timestep)\n\n# after\nx0 = scheduler._convert_model_output(model_output, sample=sample)","handlingStrategy":"validation","validationCode":"# Only relevant when calling internals directly / subclassing\nassert sample is not None, \"sample tensor is required for model-output conversion\"\nx0 = scheduler._convert_model_output(model_output, sample=sample)","typeGuard":"import torch\n\ndef has_sample(sample) -> bool:\n    return isinstance(sample, torch.Tensor) and sample.dim() >= 1","tryCatchPattern":null,"preventionTips":["Prefer the public step(model_output, timestep, sample) API; it forwards sample for you.","Always pass sample as a keyword argument to internal helpers — positional layouts change between versions.","timestep/prev_timestep keyword args on these helpers are deprecated no-ops; stop forwarding them."],"tags":["python","diffusion","scheduler","internal-api","api-misuse"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}