{"record":{"id":"be32a5cab9599045","repo":"sgl-project/sglang","slug":"self-config-timestep-spacing-is-not-supported-p","errorCode":null,"errorMessage":"{self.config.timestep_spacing} is not supported. Please make sure to choose one of 'linspace', 'leading' or 'trailing'.","messagePattern":"(.+?) is not supported\\. Please make sure to choose one of 'linspace', 'leading' or 'trailing'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py","lineNumber":414,"sourceCode":"                (np.arange(0, num_inference_steps + 1) * step_ratio)\n                .round()[::-1][:-1]\n                .copy()\n                .astype(np.int64)\n            )\n            timesteps += self.config.steps_offset\n        elif self.config.timestep_spacing == \"trailing\":\n            step_ratio = self.config.num_train_timesteps / num_inference_steps\n            # creates integer timesteps by multiplying by ratio\n            # casting to int to avoid issues when num_inference_step is power of 3\n            timesteps = (\n                np.arange(self.config.num_train_timesteps, 0, -step_ratio)\n                .round()\n                .copy()\n                .astype(np.int64)\n            )\n            timesteps -= 1\n        else:\n            raise ValueError(\n                f\"{self.config.timestep_spacing} is not supported. Please make sure to choose one of 'linspace', 'leading' or 'trailing'.\"\n            )\n\n        sigmas = np.array(((1 - self.alphas_cumprod) / self.alphas_cumprod) ** 0.5)\n        if self.config.use_karras_sigmas:\n            log_sigmas = np.log(sigmas)\n            sigmas = np.flip(sigmas).copy()\n            sigmas = self._convert_to_karras(\n                in_sigmas=sigmas, num_inference_steps=num_inference_steps\n            )\n            if self.config.use_flow_sigmas:\n                # Karras builds sigmas in EDM space; flow-matching models expect\n                # sigmas in [0, 1]. Map EDM -> flow with sigma / (sigma + 1) and\n                # derive timesteps from the flow sigmas (matches diffusers >=0.38).\n                sigmas = sigmas / (sigmas + 1)\n                timesteps = (sigmas * self.config.num_train_timesteps).copy()\n            else:\n                timesteps = np.array(","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py#L396-L432","documentation":"Raised by set_timesteps when config.timestep_spacing is not 'linspace', 'leading', or 'trailing'. The scheduler branches on this value to compute the timestep grid; an unrecognized spacing cannot produce timesteps.","triggerScenarios":"Calling scheduler.set_timesteps(num_inference_steps) after constructing the scheduler with timestep_spacing set to e.g. 'hop' or a typo like 'trailng'.","commonSituations":"Configs ported from schedulers that support additional spacings (e.g. DDIM-style or LCM 'trailing' variants), or manual config edits. Zero terminal SNR workflows usually require 'trailing'.","solutions":["Set timestep_spacing to 'linspace', 'leading', or 'trailing'","For models trained with zero terminal SNR use 'trailing' along with rescale_betas_zero_snr=True","Validate the scheduler_config.json before loading"],"exampleFix":"// before\nsched = UniPCMultistepScheduler.from_config(cfg, timestep_spacing=\"steps\")\n// after\nsched = UniPCMultistepScheduler.from_config(cfg, timestep_spacing=\"trailing\", rescale_betas_zero_snr=True)","handlingStrategy":"validation","validationCode":"assert cfg.get(\"timestep_spacing\", \"linspace\") in {\"linspace\", \"leading\", \"trailing\"}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair rescale_betas_zero_snr=True with timestep_spacing='trailing'","Validate spacing string before set_timesteps"],"tags":["scheduler","diffusion","timesteps","unipc"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}