{"record":{"id":"a4ac80711d90e2e2","repo":"sgl-project/sglang","slug":"shift-must-be-positive","errorCode":null,"errorMessage":"shift must be positive","messagePattern":"shift must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/flow_match_pair.py","lineNumber":383,"sourceCode":"            def _dual_sigma_shift(pairs: torch.Tensor, *, source: str):\n                if not isinstance(pairs, torch.Tensor):\n                    raise TypeError(\"pairs must be a torch.Tensor\")\n                if pairs.ndim != 2 or pairs.shape[1] != 2:\n                    raise ValueError(\"pairs must be a torch.Tensor of shape [N, 2]\")\n                if pairs.shape[0] == 0:\n                    raise ValueError(\"pairs length must be greater than 0\")\n                if source not in (\"timesteps\", \"sigmas\"):\n                    raise ValueError(\"source must be 'timesteps' or 'sigmas'\")\n\n                num_steps = pairs.shape[0]\n                device = pairs.device\n                dtype = pairs.dtype\n\n                def _build_column(\n                    shift_value: float, denoising_strength: float, mu_override\n                ):\n                    if shift_value <= 0:\n                        raise ValueError(\"shift must be positive\")\n                    if denoising_strength <= 0:\n                        raise ValueError(\"denoising_strength must be positive\")\n\n                    sigma_start = (\n                        self.sigma_min\n                        + (self.sigma_max - self.sigma_min) * denoising_strength\n                    )\n                    if self.extra_one_step:\n                        base = torch.linspace(\n                            sigma_start,\n                            self.sigma_min,\n                            num_steps + 1,\n                            device=device,\n                            dtype=dtype,\n                        )[:-1]\n                    else:\n                        base = torch.linspace(\n                            sigma_start,","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/flow_match_pair.py#L365-L401","documentation":"Inside _dual_sigma_shift, the per-column builder _build_column validates the modality-specific shift parameter (visual_shift / audio_shift, defaulted from scheduler.shift or kwargs). A value <= 0 (including 0.0 and negatives) raises ValueError because the flow-match shift multiplies/expands the sigma schedule and only positive values are mathematically valid.","triggerScenarios":"set_pair_postprocess_by_name('dual_sigma_shift', visual_shift=0, ...) or audio_shift=-1, or a scheduler constructed with shift=0.0 (default in some configs) and no per-modality override — the check fires when the postprocess runs on the first timestep refresh.","commonSituations":"Copy-pasting a unimodal config where shift=0 meant 'no shift' — in the dual path you must disable shifting differently; reading shift from a model config field that is absent and defaults to 0; typo'd negative value in YAML.","solutions":["Set a positive shift, e.g. set_pair_postprocess_by_name('dual_sigma_shift', visual_shift=3.0, audio_shift=3.0)","If the base scheduler shift is 0, override both per-modality kwargs since they inherit it by default","Validate config at load time: shift values must be > 0 for dual_sigma_shift","If you truly want no shift, use a different postprocess mode (None) instead of shift=0"],"exampleFix":"# before\nscheduler.set_pair_postprocess_by_name(\"dual_sigma_shift\", visual_shift=0, audio_shift=0)\n\n# after\nscheduler.set_pair_postprocess_by_name(\"dual_sigma_shift\", visual_shift=3.0, audio_shift=3.0)","handlingStrategy":"validation","validationCode":"visual_shift = float(cfg.get(\"visual_shift\", 3.0))\naudio_shift = float(cfg.get(\"audio_shift\", 3.0))\nif visual_shift <= 0 or audio_shift <= 0:\n    raise ValueError(\"shift values for dual_sigma_shift must be > 0\")\nscheduler.set_pair_postprocess_by_name(\n    \"dual_sigma_shift\",\n    visual_shift=visual_shift,\n    audio_shift=audio_shift,\n)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use shift=0 to mean 'disabled' with dual_sigma_shift; disable via postprocess None","Validate shift > 0 and denoising_strength > 0 at config load time","Remember kwargs inherit scheduler.shift by default — check the base value too"],"tags":["scheduler","config-validation","sigma-shift","flow-matching"],"backgroundTag":"invalid-parameter-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}