sgl-project/sglang · error · NotImplementedError

{solver_type} is not implemented for {self.__class__}

Error message

{solver_type} is not implemented for {self.__class__}

What it means

Raised in UniPCMultistepScheduler.__init__ when solver_type is not 'bh1' or 'bh2' and not one of the legacy aliases ('midpoint', 'heun', 'logrho') which are auto-remapped to 'bh2'. Only the B(h) formulations bh1 (B_h = h) and bh2 (B_h = expm1(h)) are implemented for the UniPC solver.

Source

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

        if rescale_betas_zero_snr:
            # Close to 0 without being 0 so first sigma is not inf
            # FP16 smallest positive subnormal works well here
            self.alphas_cumprod[-1] = 2**-24

        # Currently we only support VP-type noise schedule
        self.alpha_t = torch.sqrt(self.alphas_cumprod)
        self.sigma_t = torch.sqrt(1 - self.alphas_cumprod)
        self.lambda_t = torch.log(self.alpha_t) - torch.log(self.sigma_t)
        self.sigmas = ((1 - self.alphas_cumprod) / self.alphas_cumprod) ** 0.5

        # standard deviation of the initial noise distribution
        self.init_noise_sigma = 1.0

        if solver_type not in ["bh1", "bh2"]:
            if solver_type in ["midpoint", "heun", "logrho"]:
                self.register_to_config(solver_type="bh2")
            else:
                raise NotImplementedError(
                    f"{solver_type} is not implemented for {self.__class__}"
                )

        self.predict_x0 = predict_x0
        # setable values
        self.num_inference_steps = None
        timesteps = np.linspace(
            0, num_train_timesteps - 1, num_train_timesteps, dtype=np.float32
        )[::-1].copy()
        self.timesteps = torch.from_numpy(timesteps)
        self.num_train_timesteps = num_train_timesteps
        self.model_outputs = [None] * solver_order
        self.timestep_list = [None] * solver_order
        self.lower_order_nums = 0
        self.disable_corrector = disable_corrector
        self.solver_p = solver_p
        self.last_sample = None
        self._step_index = None

View on GitHub (pinned to 0132848349)

Solutions

  1. Use solver_type='bh1' or 'bh2' (bh2 is the default and more accurate)
  2. If you passed 'midpoint', 'heun', or 'logrho' you should not see this — otherwise rename to 'bh2'
  3. Inspect the model's scheduler config JSON and correct the stored solver_type

Example fix

// before
UniPCMultistepScheduler.from_config(cfg, solver_type="heun_midpoint")
// after
UniPCMultistepScheduler.from_config(cfg, solver_type="bh2")
Defensive patterns

Strategy: validation

Validate before calling

assert cfg.get("solver_type", "bh2") in {"bh1", "bh2", "midpoint", "heun", "logrho"}

Prevention

When it happens

Trigger: Creating the scheduler with solver_type='euler', 'rk4', or any string other than bh1/bh2/midpoint/heun/logrho.

Common situations: Users copying solver_type from other schedulers (e.g. DPMSolverSDESque terms) or assuming arbitrary solver names are supported; stale config files referencing removed solver names.

Related errors


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