microsoft/VibeVoice · error · ValueError

missing `sample` as a required keyword argument

Error message

missing `sample` as a required keyword argument

What it means

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.

Source

Thrown at vibevoice/schedule/dpm_solver.py:562

        </Tip>

        Args:
            model_output (`torch.Tensor`):
                The direct output from the learned diffusion model.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.

        Returns:
            `torch.Tensor`:
                The converted model output.
        """
        timestep = args[0] if len(args) > 0 else kwargs.pop("timestep", None)
        if sample is None:
            if len(args) > 1:
                sample = args[1]
            else:
                raise ValueError("missing `sample` as a required keyword argument")
        if timestep is not None:
            deprecate(
                "timesteps",
                "1.0.0",
                "Passing `timesteps` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`",
            )

        # DPM-Solver++ needs to solve an integral of the data prediction model.
        if self.config.algorithm_type in ["dpmsolver++", "sde-dpmsolver++"]:
            if self.config.prediction_type == "epsilon":
                # DPM-Solver and DPM-Solver++ only need the "mean" output.
                if self.config.variance_type in ["learned", "learned_range"]:
                    model_output = model_output[:, :3]
                sigma = self.sigmas[self.step_index]
                alpha_t, sigma_t = self._sigma_to_alpha_sigma_t(sigma)
                x0_pred = (sample - sigma_t * model_output) / alpha_t
            elif self.config.prediction_type == "sample":
                x0_pred = model_output

View on GitHub (pinned to 94da20d98b)

Solutions

  1. Pass the sample explicitly: `scheduler._convert_model_output(model_output, sample=sample)`.
  2. Better: don't call the helper directly — call `scheduler.step(model_output, timestep, sample)` which handles conversion, stepping, and counter updates.
  3. In subclasses, forward `*args, **kwargs` intact to super().

Example fix

# before
x0 = scheduler._convert_model_output(model_output, timestep)

# after
x0 = scheduler._convert_model_output(model_output, sample=sample)
Defensive patterns

Strategy: validation

Validate before calling

# Only relevant when calling internals directly / subclassing
assert sample is not None, "sample tensor is required for model-output conversion"
x0 = scheduler._convert_model_output(model_output, sample=sample)

Type guard

import torch

def has_sample(sample) -> bool:
    return isinstance(sample, torch.Tensor) and sample.dim() >= 1

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/VibeVoice@94da20d98b (2026-08-15). Data as JSON: /api/errors/e94c07f9cf2b4dfd. Report an issue: GitHub.