sgl-project/sglang · error · NotImplementedError
{beta_schedule} is not implemented for {self.__class__}
Error message
{beta_schedule} is not implemented for {self.__class__} What it means
Raised in UniPCMultistepScheduler.__init__ when the beta_schedule config value is not one of the supported schedules ('linear', 'scaled_linear', 'squaredcos_cap_v2'). The scheduler maps the schedule name to a betas array; unknown names cannot be mapped, so construction fails.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py:280
self.betas = torch.linspace(
beta_start, beta_end, num_train_timesteps, dtype=torch.float32
)
elif beta_schedule == "scaled_linear":
# this schedule is very specific to the latent diffusion model.
self.betas = (
torch.linspace(
beta_start**0.5,
beta_end**0.5,
num_train_timesteps,
dtype=torch.float32,
)
** 2
)
elif beta_schedule == "squaredcos_cap_v2":
# Glide cosine schedule
self.betas = betas_for_alpha_bar(num_train_timesteps)
else:
raise NotImplementedError(
f"{beta_schedule} is not implemented for {self.__class__}"
)
if rescale_betas_zero_snr:
self.betas = rescale_zero_terminal_snr(self.betas)
self.alphas = 1.0 - self.betas
self.alphas_cumprod = torch.cumprod(self.alphas, dim=0)
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)View on GitHub (pinned to 0132848349)
Solutions
- Set beta_schedule to 'scaled_linear' (the default) or 'linear' or 'squaredcos_cap_v2'
- Check the saved scheduler_config.json of the model you are loading for the exact original value
- If you need a cosine schedule, use 'squaredcos_cap_v2' which is the Glide cosine schedule
Example fix
// before sched = UniPCMultistepScheduler.from_config(cfg, beta_schedule="cosine") // after sched = UniPCMultistepScheduler.from_config(cfg, beta_schedule="squaredcos_cap_v2")
Defensive patterns
Strategy: validation
Validate before calling
from sglang.multimodal_gen.runtime.models.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
allowed = {"linear", "scaled_linear", "squaredcos_cap_v2"}
assert cfg["beta_schedule"] in allowed, f"beta_schedule must be one of {allowed}" Prevention
- Whitelist-check scheduler config values before from_config
- Prefer loading the model's original scheduler_config.json over hand-writing it
When it happens
Trigger: Instantiating UniPCMultistepScheduler(from_config(...)) or from_pretrained with config beta_schedule set to a typo or unsupported value like 'cosine' (instead of 'squaredcos_cap_v2') or 'linear_beta'.
Common situations: Hand-written scheduler configs copied from other libraries (e.g. 'cosine' used in k-diffusion/other schedulers), typos, or config JSONs migrated from a diffusers version with different schedule names.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- {solver_type} is not implemented for {self.__class__}
- {self.config.timestep_spacing} is not supported. Please make
- `final_sigmas_type` must be one of 'zero', or 'sigma_min', b
- missing `sample` as a required keyword argument
- prediction_type given as {self.config.prediction_type} must
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/1a77fa15c90aeedf.
Report an issue: GitHub.