sgl-project/sglang · error · ValueError

Unknown pair_postprocess name: {name}

Error message

Unknown pair_postprocess name: {name}

What it means

set_pair_postprocess_by_name only recognizes a fixed set of built-in pair postprocess names (e.g. 'dual_sigma_shift'); any other string reaches the trailing raise. The name is matched before this line, so the value passed is simply not one of the implemented options.

Source

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

                        scale_factor = one_minus_z[-1] / (1 - self.shift_terminal)
                        if scale_factor != 0:
                            base = 1 - (one_minus_z / scale_factor)

                    if self.reverse_sigmas:
                        base = 1 - base

                    if source == "timesteps":
                        return base * self.num_train_timesteps
                    return base

                col0 = _build_column(visual_shift, visual_denoising_strength, visual_mu)
                col1 = _build_column(audio_shift, audio_denoising_strength, audio_mu)
                return torch.stack([col0, col1], dim=1)

            _dual_sigma_shift._requires_source = True
            self.set_pair_postprocess(_dual_sigma_shift)
            return
        raise ValueError(f"Unknown pair_postprocess name: {name}")

    def _make_pairs_from_vector(self, vec: torch.Tensor) -> torch.Tensor:
        if vec.ndim != 1:
            raise ValueError("vec must be 1D")
        return torch.stack([vec, vec], dim=1)

    def get_pairs(self, source: str = "timesteps") -> torch.Tensor:
        if source == "timesteps":
            if self.pair_timesteps is None:
                self._refresh_pair_cache()
            return self.pair_timesteps
        if source == "sigmas":
            if self.pair_sigmas is None:
                self._refresh_pair_cache()
            return self.pair_sigmas
        raise ValueError("source must be 'timesteps' or 'sigmas'")

    def timestep_to_sigma(self, timestep: torch.Tensor | float) -> torch.Tensor:

View on GitHub (pinned to 0132848349)

Solutions

  1. Use the exact supported name, e.g. 'dual_sigma_shift'
  2. If you need custom behavior, pass a callable via set_pair_postprocess(fn) instead of a name
  3. Inspect the if/elif chain above line 442 to enumerate valid names

Example fix

# before
sched.set_pair_postprocess_by_name("dual_shift")
# after
sched.set_pair_postprocess_by_name("dual_sigma_shift")
Defensive patterns

Strategy: validation

Validate before calling

VALID = {"dual_sigma_shift"}
if name not in VALID:
    raise ValueError(f"unsupported pair_postprocess {name!r}; valid: {VALID}")

Type guard

def is_valid_pair_postprocess(name: str) -> bool:
    return name == "dual_sigma_shift"

Prevention

When it happens

Trigger: Calling set_pair_postprocess_by_name('sigma_shift') or any typo'd/unimplemented name; forward() also routes to this method when configured with a name string.

Common situations: Renamed or upstream-removed postprocess names after a version change; copy-pasting a name from another scheduler codebase.

Related errors


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