sgl-project/sglang · error · ValueError

denoising_strength must be positive

Error message

denoising_strength must be positive

What it means

Raised by the pair scheduler when building a per-modality sigma column with a non-positive denoising_strength. denoising_strength scales the sigma range (sigma_min + (sigma_max - sigma_min) * denoising_strength), so it must be > 0. It is part of _dual_sigma_shift setup, typically invoked via set_pair_postprocess_by_name('dual_sigma_shift', ...).

Source

Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/flow_match_pair.py:385

                    raise TypeError("pairs must be a torch.Tensor")
                if pairs.ndim != 2 or pairs.shape[1] != 2:
                    raise ValueError("pairs must be a torch.Tensor of shape [N, 2]")
                if pairs.shape[0] == 0:
                    raise ValueError("pairs length must be greater than 0")
                if source not in ("timesteps", "sigmas"):
                    raise ValueError("source must be 'timesteps' or 'sigmas'")

                num_steps = pairs.shape[0]
                device = pairs.device
                dtype = pairs.dtype

                def _build_column(
                    shift_value: float, denoising_strength: float, mu_override
                ):
                    if shift_value <= 0:
                        raise ValueError("shift must be positive")
                    if denoising_strength <= 0:
                        raise ValueError("denoising_strength must be positive")

                    sigma_start = (
                        self.sigma_min
                        + (self.sigma_max - self.sigma_min) * denoising_strength
                    )
                    if self.extra_one_step:
                        base = torch.linspace(
                            sigma_start,
                            self.sigma_min,
                            num_steps + 1,
                            device=device,
                            dtype=dtype,
                        )[:-1]
                    else:
                        base = torch.linspace(
                            sigma_start,
                            self.sigma_min,
                            num_steps,

View on GitHub (pinned to 0132848349)

Solutions

  1. Set denoising_strength to a positive fraction, e.g. 0.5–1.0 (1.0 uses the full sigma range)
  2. Check the config source that populates the strength value and add a default like 1.0
  3. Validate strengths > 0 before calling set_pair_postprocess_by_name

Example fix

// before
sched.set_pair_postprocess_by_name("dual_sigma_shift", audio_shift=1.0, audio_denoising_strength=0.0, ...)
// after
sched.set_pair_postprocess_by_name("dual_sigma_shift", audio_shift=1.0, audio_denoising_strength=0.5, ...)
Defensive patterns

Strategy: validation

Validate before calling

strength = cfg.get("audio_denoising_strength", 1.0)
assert strength > 0, f"denoising_strength must be > 0, got {strength}"

Prevention

When it happens

Trigger: Calling set_pair_postprocess_by_name with a dual-shift configuration where audio_denoising_strength (or image) is 0 or negative; reading the value from a config dict that defaults to 0 or was parsed as int(0).

Common situations: YAML/JSON generation configs omitting denoising_strength causing a 0 default; multiplying a strength by a resolution ratio that evaluates to 0; passing strength as a fraction >1 typo like 0.0.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/6aabb3c9b40d6d25. Report an issue: GitHub.