{"record":{"id":"d20ac73666ada434","repo":"microsoft/VibeVoice","slug":"must-pass-exactly-one-of-num-inference-steps-or","errorCode":null,"errorMessage":"Must pass exactly one of `num_inference_steps` or `timesteps`.","messagePattern":"Must pass exactly one of `num_inference_steps` or `timesteps`\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vibevoice/schedule/dpm_solver.py","lineNumber":341,"sourceCode":"        num_inference_steps: int = None,\n        device: Union[str, torch.device] = None,\n        timesteps: Optional[List[int]] = None,\n    ):\n        \"\"\"\n        Sets the discrete timesteps used for the diffusion chain (to be run before inference).\n\n        Args:\n            num_inference_steps (`int`):\n                The number of diffusion steps used when generating samples with a pre-trained model.\n            device (`str` or `torch.device`, *optional*):\n                The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.\n            timesteps (`List[int]`, *optional*):\n                Custom timesteps used to support arbitrary timesteps schedule. If `None`, timesteps will be generated\n                based on the `timestep_spacing` attribute. If `timesteps` is passed, `num_inference_steps` and `sigmas`\n                must be `None`, and `timestep_spacing` attribute will be ignored.\n        \"\"\"\n        if num_inference_steps is None and timesteps is None:\n            raise ValueError(\"Must pass exactly one of `num_inference_steps` or `timesteps`.\")\n        if num_inference_steps is not None and timesteps is not None:\n            raise ValueError(\"Can only pass one of `num_inference_steps` or `custom_timesteps`.\")\n        if timesteps is not None and self.config.use_karras_sigmas:\n            raise ValueError(\"Cannot use `timesteps` with `config.use_karras_sigmas = True`\")\n        if timesteps is not None and self.config.use_lu_lambdas:\n            raise ValueError(\"Cannot use `timesteps` with `config.use_lu_lambdas = True`\")\n\n        if timesteps is not None:\n            timesteps = np.array(timesteps).astype(np.int64)\n        else:\n            # Clipping the minimum of all lambda(t) for numerical stability.\n            # This is critical for cosine (squaredcos_cap_v2) noise schedule.\n            clipped_idx = torch.searchsorted(torch.flip(self.lambda_t, [0]), self.config.lambda_min_clipped)\n            last_timestep = ((self.config.num_train_timesteps - clipped_idx).numpy()).item()\n\n            # \"linspace\", \"leading\", \"trailing\" corresponds to annotation of Table 2. of https://arxiv.org/abs/2305.08891\n            if self.config.timestep_spacing == \"linspace\":\n                timesteps = (","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/schedule/dpm_solver.py#L323-L359","documentation":"`set_timesteps()` requires exactly one of `num_inference_steps` or `timesteps`; calling with neither (both None) leaves the scheduler with no timestep grid, so it raises ValueError up front. This is an API-contract check copied from diffusers — you must tell the scheduler how many steps (or exactly which timesteps) to run.","triggerScenarios":"`scheduler.set_timesteps()` with no arguments, or code that conditionally computes `num_inference_steps` and the variable ends up None (e.g., a config key miss), or passing `num_inference_steps=None` explicitly to 'use defaults'.","commonSituations":"Wrapping the scheduler in a generic pipeline where step count comes from config and the key is absent; refactoring that moves the step-count argument into kwargs and forgets to forward it.","solutions":["Pass a step count: `scheduler.set_timesteps(30)`.","If you intended custom timesteps, pass `timesteps=[... , device=...)` list instead.","Trace where your pipeline computes num_inference_steps and give it a concrete default when config omits it."],"exampleFix":"# before\nscheduler.set_timesteps()  # ValueError\n\n# after\nscheduler.set_timesteps(num_inference_steps=30)","handlingStrategy":"validation","validationCode":"if num_inference_steps is None and timesteps is None:\n    num_inference_steps = 30  # your default\nscheduler.set_timesteps(\n    num_inference_steps=num_inference_steps, timesteps=timesteps\n)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always give num_inference_steps a concrete default in config-driven pipelines.","Fail fast when the config key is missing instead of letting None flow to set_timesteps.","set_timesteps is mandatory setup — pair scheduler creation and set_timesteps in one function."],"tags":["python","diffusion","scheduler","api-misuse","timesteps"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}