{"record":{"id":"81932f4933c5cd0b","repo":"sgl-project/sglang","slug":"only-one-of-timesteps-or-sigmas-can-be-passed-81932f","errorCode":null,"errorMessage":"Only one of `timesteps` or `sigmas` can be passed. Please choose one to set custom values","messagePattern":"Only one of `timesteps` or `sigmas` can be passed\\. Please choose one to set custom values","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/qwen_image_layered.py","lineNumber":125,"sourceCode":"            The scheduler to get timesteps from.\n        num_inference_steps (`int`):\n            The number of diffusion steps used when generating samples with a pre-trained model. If used, `timesteps`\n            must be `None`.\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 override the timestep spacing strategy of the scheduler. If `timesteps` is passed,\n            `num_inference_steps` and `sigmas` must be `None`.\n        sigmas (`List[float]`, *optional*):\n            Custom sigmas used to override the timestep spacing strategy of the scheduler. If `sigmas` is passed,\n            `num_inference_steps` and `timesteps` must be `None`.\n\n    Returns:\n        `Tuple[torch.Tensor, int]`: A tuple where the first element is the timestep schedule from the scheduler and the\n        second element is the number of inference steps.\n    \"\"\"\n    if timesteps is not None and sigmas is not None:\n        raise ValueError(\n            \"Only one of `timesteps` or `sigmas` can be passed. Please choose one to set custom values\"\n        )\n    if timesteps is not None:\n        accepts_timesteps = \"timesteps\" in set(\n            inspect.signature(scheduler.set_timesteps).parameters.keys()\n        )\n        if not accepts_timesteps:\n            raise ValueError(\n                f\"The current scheduler class {scheduler.__class__}'s `set_timesteps` does not support custom\"\n                f\" timestep schedules. Please check whether you are using the correct scheduler.\"\n            )\n        scheduler.set_timesteps(timesteps=timesteps, device=device, **kwargs)\n        timesteps = scheduler.timesteps\n        num_inference_steps = len(timesteps)\n    elif sigmas is not None:\n        accept_sigmas = \"sigmas\" in set(\n            inspect.signature(scheduler.set_timesteps).parameters.keys()\n        )","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/qwen_image_layered.py#L107-L143","documentation":"retrieve_timesteps (copied from diffusers) builds the denoising schedule and allows customizing it via either an explicit timesteps array or a sigmas array — but only one. Passing both is ambiguous, so it raises immediately.","triggerScenarios":"Calling the pipeline/stage with both timesteps=... and sigmas=... keyword arguments in the same call (e.g. timesteps=[999, 500, 100] and sigmas=[14.6, 3.0, 0.0]).","commonSituations":"Copy-pasting example code that sets both when migrating from another scheduler API; building a config dict that merges defaults for both fields and splats **cfg into the call; upgrading diffusers-style code where old code set sigmas and new code added timesteps.","solutions":["Delete one of the two arguments — keep whichever your scheduler actually consumes (flow-matching schedulers typically use sigmas; DDPM-style use timesteps).","If merging config dicts, pop the unused key before the call.","Prefer passing num_inference_steps alone unless you truly need a custom schedule."],"exampleFix":"# before\nstage(..., timesteps=[999, 750, 500], sigmas=[14.6, 5.0, 0.0])\n\n# after\nstage(..., sigmas=[14.6, 5.0, 0.0])","handlingStrategy":"validation","validationCode":"assert not (timesteps is not None and sigmas is not None), \"pass only one of timesteps/sigmas\"","typeGuard":"def schedule_args_ok(timesteps, sigmas) -> bool:\n    return not (timesteps is not None and sigmas is not None)","tryCatchPattern":null,"preventionTips":["Default both to None in your wrapper and set exactly one from config.","Use num_inference_steps unless a custom schedule is required."],"tags":["qwen-image","diffusers","scheduler","timesteps","sigmas","mutually-exclusive-args"],"backgroundTag":"conflicting-arguments","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}