{"record":{"id":"4bdb2c1ad53221f2","repo":"sgl-project/sglang","slug":"final-sigmas-type-must-be-one-of-zero-or-sig-4bdb2c","errorCode":null,"errorMessage":"`final_sigmas_type` must be one of 'zero', or 'sigma_min', but got {self.config.final_sigmas_type}","messagePattern":"`final_sigmas_type` must be one of 'zero', or 'sigma_min', but got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py","lineNumber":440,"sourceCode":"            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(\n                    [self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas]\n                ).round()\n            if self.config.final_sigmas_type == \"sigma_min\":\n                sigma_last = sigmas[-1]\n            elif self.config.final_sigmas_type == \"zero\":\n                sigma_last = 0\n            else:\n                raise ValueError(\n                    f\"`final_sigmas_type` must be one of 'zero', or 'sigma_min', but got {self.config.final_sigmas_type}\"\n                )\n            sigmas = np.concatenate([sigmas, [sigma_last]]).astype(np.float32)\n        elif self.config.use_exponential_sigmas:\n            log_sigmas = np.log(sigmas)\n            sigmas = np.flip(sigmas).copy()\n            sigmas = self._convert_to_exponential(\n                in_sigmas=sigmas, num_inference_steps=num_inference_steps\n            )\n            timesteps = np.array(\n                [self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas]\n            )\n            if self.config.final_sigmas_type == \"sigma_min\":\n                sigma_last = sigmas[-1]\n            elif self.config.final_sigmas_type == \"zero\":\n                sigma_last = 0\n            else:\n                raise ValueError(","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py#L422-L458","documentation":"Raised by set_timesteps (Karras sigma path) when final_sigmas_type is neither 'zero' nor 'sigma_min'. This determines the sigma appended after the last timestep when use_karras_sigmas=True.","triggerScenarios":"scheduler.set_timesteps(N) with use_karras_sigmas=True and final_sigmas_type set to an invalid string (e.g. 'sigma_last', '').","commonSituations":"Configs copied from EDM-style pipelines where 'sigma_min' semantics differ, or default None value being written as a string; older diffusers versions lacked this key and hand-merged configs get it wrong.","solutions":["Set final_sigmas_type='zero' (default for most DDPM-style models)","Set final_sigmas_type='sigma_min' for models trained with nonzero terminal noise","Remove the key entirely to accept the default rather than setting an invalid string"],"exampleFix":"// before\nUniPCMultistepScheduler.from_config(cfg, use_karras_sigmas=True, final_sigmas_type=\"sigma_last\")\n// after\nUniPCMultistepScheduler.from_config(cfg, use_karras_sigmas=True, final_sigmas_type=\"zero\")","handlingStrategy":"validation","validationCode":"assert cfg.get(\"final_sigmas_type\", \"zero\") in {\"zero\", \"sigma_min\"}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit final_sigmas_type rather than setting an arbitrary string","Prefer 'zero' unless the model was trained with nonzero terminal noise"],"tags":["scheduler","diffusion","sigmas","karras","unipc"],"backgroundTag":"unsupported-parameter-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}