{"record":{"id":"0d541b3936a91565","repo":"microsoft/VibeVoice","slug":"number-of-inference-steps-is-none-you-need-to-r","errorCode":null,"errorMessage":"Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler","messagePattern":"Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vibevoice/schedule/dpm_solver.py","lineNumber":970,"sourceCode":"                The current discrete timestep in the diffusion chain.\n            sample (`torch.Tensor`):\n                A current instance of a sample created by the diffusion process.\n            generator (`torch.Generator`, *optional*):\n                A random number generator.\n            variance_noise (`torch.Tensor`):\n                Alternative to generating noise with `generator` by directly providing the noise for the variance\n                itself. Useful for methods such as [`LEdits++`].\n            return_dict (`bool`):\n                Whether or not to return a [`~schedulers.scheduling_utils.SchedulerOutput`] or `tuple`.\n\n        Returns:\n            [`~schedulers.scheduling_utils.SchedulerOutput`] or `tuple`:\n                If return_dict is `True`, [`~schedulers.scheduling_utils.SchedulerOutput`] is returned; otherwise, a\n                tuple is returned where the first element is the sample tensor.\n\n        \"\"\"\n        if self.num_inference_steps is None:\n            raise ValueError(\n                \"Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler\"\n            )\n\n        if self.step_index is None:\n            self._init_step_index(timestep)\n\n        # Improve numerical stability for small number of steps\n        lower_order_final = (self.step_index == len(self.timesteps) - 1) and (\n            self.config.euler_at_final\n            or (self.config.lower_order_final and len(self.timesteps) < 15)\n            or self.config.final_sigmas_type == \"zero\"\n        )\n        lower_order_second = (\n            (self.step_index == len(self.timesteps) - 2) and self.config.lower_order_final and len(self.timesteps) < 15\n        )\n\n        model_output = self.convert_model_output(model_output, sample=sample)\n        for i in range(self.config.solver_order - 1):","sourceCodeStart":952,"sourceCodeEnd":988,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/schedule/dpm_solver.py#L952-L988","documentation":"`step()` requires a prepared sigma/timestep grid; `self.num_inference_steps` is None until `set_timesteps()` has run, so stepping first raises this ValueError. The scheduler deliberately stores no default schedule — every sampling loop must call set_timesteps (with a step count or custom timesteps) after construction and before the first step().","triggerScenarios":"`scheduler.step(model_output, t, sample)` before any `scheduler.set_timesteps(30)` call; also after re-creating or re-loading a scheduler mid-loop, or when an exception earlier in the pipeline skipped the set_timesteps line.","commonSituations":"Reordering pipeline code so the denoise loop runs first; wrapping schedulers in objects that lazy-init; copying example code that omitted the set_timesteps line; resuming from a checkpoint without re-running setup.","solutions":["Call `scheduler.set_timesteps(num_inference_steps=N)` once after creating the scheduler and before the sampling loop.","If using custom timesteps: `scheduler.set_timesteps(timesteps=[...])`.","Add a guard in your loop: `if scheduler.num_inference_steps is None: scheduler.set_timesteps(30)`."],"exampleFix":"# before\nfor t in scheduler.timesteps:\n    scheduler.step(model_output, t, sample)  # num_inference_steps is None\n\n# after\nscheduler.set_timesteps(num_inference_steps=30)\nfor t in scheduler.timesteps:\n    scheduler.step(model_output, t, sample)","handlingStrategy":"validation","validationCode":"if scheduler.num_inference_steps is None:\n    scheduler.set_timesteps(num_inference_steps=30)\nfor t in scheduler.timesteps:\n    scheduler.step(model_output, t, sample)","typeGuard":"def scheduler_is_ready(scheduler) -> bool:\n    return scheduler.num_inference_steps is not None and scheduler.timesteps is not None","tryCatchPattern":null,"preventionTips":["Encapsulate scheduler creation + set_timesteps in one setup function so they cannot be separated.","After loading or re-creating a scheduler mid-run, always re-run set_timesteps.","Assert num_inference_steps is not None at the top of your sampling loop as a cheap invariant."],"tags":["python","diffusion","scheduler","api-misuse","lifecycle"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}