{"record":{"id":"2627dba252f3f808","repo":"sgl-project/sglang","slug":"unknown-time-shift-type-self-config-time-shift-t","errorCode":null,"errorMessage":"Unknown time_shift_type: {self.config.time_shift_type}","messagePattern":"Unknown time_shift_type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py","lineNumber":249,"sourceCode":"        while len(sigma.shape) < len(sample.shape):\n            sigma = sigma.unsqueeze(-1)\n\n        sample = sigma * noise + (1.0 - sigma) * sample\n\n        return sample\n\n    def _sigma_to_t(self, sigma: float) -> float:\n        return sigma * self.config.num_train_timesteps\n\n    def time_shift(\n        self, mu: float, sigma: float, t: torch.Tensor | np.ndarray\n    ) -> torch.Tensor | np.ndarray:\n        if self.config.time_shift_type == \"exponential\":\n            return self._time_shift_exponential(mu, sigma, t)\n        elif self.config.time_shift_type == \"linear\":\n            return self._time_shift_linear(mu, sigma, t)\n        else:\n            raise ValueError(f\"Unknown time_shift_type: {self.config.time_shift_type}\")\n\n    def stretch_shift_to_terminal(self, t: torch.Tensor) -> torch.Tensor:\n        r\"\"\"\n        Stretches and shifts the timestep schedule to ensure it terminates at the configured `shift_terminal` config\n        value.\n\n        Reference:\n        https://github.com/Lightricks/LTX-Video/blob/a01a171f8fe3d99dce2728d60a73fecf4d4238ae/ltx_video/schedulers/rf.py#L51\n\n        Args:\n            t (`torch.Tensor`):\n                A tensor of timesteps to be stretched and shifted.\n\n        Returns:\n            `torch.Tensor`:\n                A tensor of adjusted timesteps such that the final value equals `self.config.shift_terminal`.\n        \"\"\"\n        one_minus_z = 1 - t","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py#L231-L267","documentation":"time_shift() dispatches on config.time_shift_type and raises for any value other than the two supported branches. It runs during set_timesteps, so a bad value can slip past the constructor if the config was mutated after construction.","triggerScenarios":"Constructing the scheduler, then setting scheduler.config.time_shift_type = 'custom' before set_timesteps; bypassing the constructor check by mutating a loaded config dict.","commonSituations":"Runtime config overrides, patches applied by pipelines, or config deserialization paths that skip __init__ validation.","solutions":["Reset time_shift_type to 'exponential' or 'linear' before set_timesteps","Re-instantiate the scheduler with a valid type so constructor validation runs","Avoid mutating scheduler.config after construction"],"exampleFix":"# before\nscheduler.config.time_shift_type = \"sigmoid\"  # later set_timesteps -> error\n# after\nscheduler.config.time_shift_type = \"linear\"","handlingStrategy":"validation","validationCode":"assert scheduler.config.time_shift_type in {\"exponential\", \"linear\"}\nscheduler.set_timesteps(steps, mu=mu)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't mutate scheduler.config after construction","Re-validate config before set_timesteps if mutation is unavoidable"],"tags":["scheduler","invalid-enum-value","config-mutation"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}