{"record":{"id":"0e69796fdd3fb732","repo":"microsoft/VibeVoice","slug":"missing-sample-as-a-required-keyword-argument-0e6979","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":654,"sourceCode":"        One step for the first-order DPMSolver (equivalent to DDIM).\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 sample tensor at the previous timestep.\n        \"\"\"\n        timestep = args[0] if len(args) > 0 else kwargs.pop(\"timestep\", None)\n        prev_timestep = args[1] if len(args) > 1 else kwargs.pop(\"prev_timestep\", None)\n        if sample is None:\n            if len(args) > 2:\n                sample = args[2]\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        if prev_timestep is not None:\n            deprecate(\n                \"prev_timestep\",\n                \"1.0.0\",\n                \"Passing `prev_timestep` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`\",\n            )\n\n        sigma_t, sigma_s = self.sigmas[self.step_index + 1], self.sigmas[self.step_index]\n        alpha_t, sigma_t = self._sigma_to_alpha_sigma_t(sigma_t)\n        alpha_s, sigma_s = self._sigma_to_alpha_sigma_t(sigma_s)\n        lambda_t = torch.log(alpha_t) - torch.log(sigma_t)","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/schedule/dpm_solver.py#L636-L672","documentation":"`_dpm_solver_first_order_update` (the single-step DPM-Solver update) needs the current `sample`; it checks the keyword, then args[2], then raises this ValueError. It is an internal method invoked by `step()` — hitting it means direct/subclass invocation dropped the sample argument. Standard pipeline usage cannot trigger it.","triggerScenarios":"Calling `scheduler._dpm_solver_first_order_update(model_output, timestep, prev_timestep)` without `sample=...`, or a custom `step()` override forwarding only two positional args.","commonSituations":"Custom scheduler subclasses for batched audio tokens; research code reimplementing step() but reusing the first-order update helper.","solutions":["Pass sample: `scheduler._dpm_solver_first_order_update(model_output, sample=sample)` (timestep args are deprecated no-ops).","Prefer relying on the public `step()` which supplies sample internally.","In overrides, forward `sample=sample` explicitly rather than relying on positional order."],"exampleFix":"# before\nprev = sched._dpm_solver_first_order_update(mo, t, t_prev)\n\n# after\nprev = sched._dpm_solver_first_order_update(mo, sample=sample)","handlingStrategy":"validation","validationCode":"assert sample is not None, \"sample tensor is required\"\nprev = scheduler._dpm_solver_first_order_update(model_output, sample=sample)","typeGuard":"import torch\n\ndef has_sample(sample) -> bool:\n    return isinstance(sample, torch.Tensor)","tryCatchPattern":null,"preventionTips":["Do not call first-order update helpers directly; use step().","In subclasses, forward sample=sample explicitly to super() methods.","Treat these helpers as private API: signatures can differ from upstream diffusers."],"tags":["python","diffusion","scheduler","internal-api","api-misuse"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}