sgl-project/sglang · error · ValueError

prediction_type given as {self.config.prediction_type} must

Error message

prediction_type given as {self.config.prediction_type} must be one of `epsilon`, `sample`, or `v_prediction` for the UniPCMultistepScheduler.

What it means

In convert_model_output (epsilon-prediction branch, predict_x0=False), prediction_type must be 'epsilon', 'sample', or 'v_prediction'. Note 'flow_prediction' is NOT valid here because epsilon conversion for flow models is undefined; the message intentionally omits it.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py:775

                    f"prediction_type given as {self.config.prediction_type} must be one of `epsilon`, `sample`, "
                    "`v_prediction`, or `flow_prediction` for the UniPCMultistepScheduler."
                )

            if self.config.thresholding:
                x0_pred = self._threshold_sample(x0_pred)

            return x0_pred
        else:
            if self.config.prediction_type == "epsilon":
                return model_output
            elif self.config.prediction_type == "sample":
                epsilon = (sample - alpha_t * model_output) / sigma_t
                return epsilon
            elif self.config.prediction_type == "v_prediction":
                epsilon = alpha_t * model_output + sigma_t * sample
                return epsilon
            else:
                raise ValueError(
                    f"prediction_type given as {self.config.prediction_type} must be one of `epsilon`, `sample`, or"
                    " `v_prediction` for the UniPCMultistepScheduler."
                )

    def multistep_uni_p_bh_update(
        self,
        model_output: torch.Tensor,
        *args,
        sample: torch.Tensor = None,
        order: int = None,
        **kwargs,
    ) -> torch.Tensor:
        """
        One step for the UniP (B(h) version). Alternatively, `self.solver_p` is used if is specified.

        Args:
            model_output (`torch.Tensor`):
                The direct output from the learned diffusion model at the current timestep.

View on GitHub (pinned to 0132848349)

Solutions

  1. If using a flow-matching model, keep predict_x0=True (default) with prediction_type='flow_prediction'
  2. Otherwise set prediction_type to 'epsilon','sample', or 'v_prediction'
  3. Verify both predict_x0 and prediction_type in the config together

Example fix

// before
UniPCMultistepScheduler.from_config(cfg, prediction_type="flow_prediction", predict_x0=False)
// after
UniPCMultistepScheduler.from_config(cfg, prediction_type="flow_prediction")  # predict_x0 defaults True
Defensive patterns

Strategy: validation

Validate before calling

assert cfg["prediction_type"] in {"epsilon", "sample", "v_prediction"}

Prevention

When it happens

Trigger: Scheduler with predict_x0=False and prediction_type='flow_prediction' or any other invalid string, then calling step().

Common situations: Using a flow model scheduler config while predict_x0 got flipped to False, or the same typos as the x0 branch.

Related errors


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