{"record":{"id":"5878d2b6db412ce3","repo":"microsoft/VibeVoice","slug":"can-only-pass-one-of-num-inference-steps-or-cus","errorCode":null,"errorMessage":"Can only pass one of `num_inference_steps` or `custom_timesteps`.","messagePattern":"Can only pass one of `num_inference_steps` or `custom_timesteps`\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vibevoice/schedule/dpm_solver.py","lineNumber":343,"sourceCode":"        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 = (\n                    np.linspace(0, last_timestep - 1, num_inference_steps + 1)\n                    .round()[::-1][:-1]","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/schedule/dpm_solver.py#L325-L361","documentation":"`set_timesteps()` raises this ValueError when both `num_inference_steps` and `timesteps` are provided, because the two would define conflicting timestep grids (the message text says `custom_timesteps`, carried over from diffusers, but it refers to the `timesteps` argument). Exactly one of the two must be non-None.","triggerScenarios":"`scheduler.set_timesteps(num_inference_steps=30, timesteps=[999, 749, ...])` — a partial refactor where old positional step counts collide with newly added custom-timestep support.","commonSituations":"Pipelines that add LEdits++/SDEdit-style custom timesteps while keeping the step-count code path; config systems that always populate both fields.","solutions":["If you want an evenly spaced schedule, drop the `timesteps` argument.","If you need specific timesteps (e.g. SDEdit partial denoising), drop `num_inference_steps` — the count is derived as `len(timesteps)`.","In config-driven code, gate the two fields so exactly one is emitted."],"exampleFix":"# before\nscheduler.set_timesteps(num_inference_steps=30, timesteps=[950, 500, 100])\n\n# after\nscheduler.set_timesteps(timesteps=[950, 500, 100])","handlingStrategy":"validation","validationCode":"if num_inference_steps is not None and timesteps is not None:\n    raise ValueError(\"Pass either num_inference_steps or timesteps, not both\")\nif num_inference_steps is None and timesteps is None:\n    raise ValueError(\"Pass one of num_inference_steps or timesteps\")\nscheduler.set_timesteps(num_inference_steps=num_inference_steps, timesteps=timesteps)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model the two options as an explicit either/or in your pipeline config schema.","Note the error text says 'custom_timesteps' but means the timesteps argument.","When supporting SDEdit-style custom timesteps, make sure the step-count code path is disabled."],"tags":["python","diffusion","scheduler","api-misuse","timesteps"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}