{"record":{"id":"8aa396e9e3d2e1fb","repo":"sgl-project/sglang","slug":"either-num-inference-steps-sigmas-or-timesteps-m","errorCode":null,"errorMessage":"Either num_inference_steps, sigmas, or timesteps must be provided","messagePattern":"Either num_inference_steps, sigmas, or timesteps must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py","lineNumber":326,"sourceCode":"            and timesteps is not None\n            and len(sigmas) != len(timesteps)\n        ):\n            raise ValueError(\"`sigmas` and `timesteps` should have the same length\")\n\n        if num_inference_steps is not None:\n            if (sigmas is not None and len(sigmas) != num_inference_steps) or (\n                timesteps is not None and len(timesteps) != num_inference_steps\n            ):\n                raise ValueError(\n                    \"`sigmas` and `timesteps` should have the same length as num_inference_steps, if `num_inference_steps` is provided\"\n                )\n        else:\n            if sigmas is not None:\n                num_inference_steps = len(sigmas)\n            elif timesteps is not None:\n                num_inference_steps = len(timesteps)\n            else:\n                raise ValueError(\n                    \"Either num_inference_steps, sigmas, or timesteps must be provided\"\n                )\n\n        self.num_inference_steps = num_inference_steps\n\n        # 1. Prepare default sigmas\n        is_timesteps_provided = timesteps is not None\n\n        timesteps_array: np.ndarray | None = None\n        if is_timesteps_provided:\n            assert timesteps is not None\n            timesteps_array = np.array(timesteps).astype(np.float32)\n\n        sigmas_array: np.ndarray\n        if sigmas is None:\n            if timesteps_array is None:\n                timesteps_array = np.linspace(\n                    self._sigma_to_t(self.sigma_max),","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py#L308-L344","documentation":"set_timesteps needs some notion of schedule size; with num_inference_steps, sigmas, and timesteps all None it cannot build the sigma schedule and raises.","triggerScenarios":"Calling scheduler.set_timesteps() with no arguments (relying on a previously stored default that does not exist in this implementation).","commonSituations":"Porting code from schedulers that default num_inference_steps=50; refactors that moved the step count into a variable that evaluates to None.","solutions":["Pass num_inference_steps explicitly: scheduler.set_timesteps(50)","Or pass a sigmas/timesteps list from which the count is inferred","Audit refactor leftovers where the steps variable became None"],"exampleFix":"# before\nscheduler.set_timesteps()\n# after\nscheduler.set_timesteps(num_inference_steps=50)","handlingStrategy":"validation","validationCode":"assert num_inference_steps is not None or sigmas is not None or timesteps is not None, \"provide steps or a schedule\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass num_inference_steps explicitly","Guard against None step counts after refactors"],"tags":["scheduler","missing-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}