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`, `v_prediction`, or `flow_prediction` for the UniPCMultistepScheduler.

What it means

In convert_model_output (x0-prediction branch, predict_x0=True / flow models), config.prediction_type must be 'epsilon', 'sample', 'v_prediction', or 'flow_prediction'; any other value cannot be converted to a clean-image prediction x0.

Source

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

                "1.0.0",
                "Passing `timesteps` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`",
            )

        sigma = self.sigmas[self.step_index]
        alpha_t, sigma_t = self._sigma_to_alpha_sigma_t(sigma)

        if self.predict_x0:
            if self.config.prediction_type == "epsilon":
                x0_pred = (sample - sigma_t * model_output) / alpha_t
            elif self.config.prediction_type == "sample":
                x0_pred = model_output
            elif self.config.prediction_type == "v_prediction":
                x0_pred = alpha_t * sample - sigma_t * model_output
            elif self.config.prediction_type == "flow_prediction":
                sigma_t = self.sigmas[self.step_index]
                x0_pred = sample - sigma_t * model_output
            else:
                raise ValueError(
                    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:

View on GitHub (pinned to 0132848349)

Solutions

  1. Set prediction_type to one of 'epsilon','sample','v_prediction','flow_prediction' matching how the model was trained
  2. For flow-matching models use 'flow_prediction' with use_flow_sigmas=True
  3. Reload the original scheduler_config.json that shipped with the model

Example fix

// before
UniPCMultistepScheduler.from_config(cfg, prediction_type="v")
// after
UniPCMultistepScheduler.from_config(cfg, prediction_type="v_prediction")
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Scheduler config with prediction_type='sample_prediction', 'x0', or set for a flow model but missing 'flow_prediction' (e.g. 'v' instead of 'v_prediction'), then calling step().

Common situations: Loading v-prediction or flow-matching checkpoints with a mismatched scheduler config; hand-edited configs using shorthand prediction names.

Related errors


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