Comfy-Org/ComfyUI · error · ValueError
schedule '{schedule}' unknown.
Error message
schedule '{schedule}' unknown. What it means
Raised by make_beta_schedule when the schedule name doesn't match any implemented beta schedule: 'linear', 'cosine', 'squaredcos_cap_v2', 'sqrt_linear', 'sqrt' (plus their quad variants). The function dispatches purely on the lowercase schedule string from the model/sampler config; unknown strings hit the trailing ValueError.
Source
Thrown at comfy/ldm/modules/diffusionmodules/util.py:117
alphas = timesteps / (1 + cosine_s) * np.pi / 2
alphas = torch.cos(alphas).pow(2)
alphas = alphas / alphas[0]
betas = 1 - alphas[1:] / alphas[:-1]
betas = torch.clamp(betas, min=0, max=0.999)
elif schedule == "squaredcos_cap_v2": # used for karlo prior
# return early
return betas_for_alpha_bar(
n_timestep,
lambda t: math.cos((t + 0.008) / 1.008 * math.pi / 2) ** 2,
)
elif schedule == "sqrt_linear":
betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64)
elif schedule == "sqrt":
betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64) ** 0.5
else:
raise ValueError(f"schedule '{schedule}' unknown.")
return betas
def make_ddim_timesteps(ddim_discr_method, num_ddim_timesteps, num_ddpm_timesteps, verbose=True):
if ddim_discr_method == 'uniform':
c = num_ddpm_timesteps // num_ddim_timesteps
ddim_timesteps = np.asarray(list(range(0, num_ddpm_timesteps, c)))
elif ddim_discr_method == 'quad':
ddim_timesteps = ((np.linspace(0, np.sqrt(num_ddpm_timesteps * .8), num_ddim_timesteps)) ** 2).astype(int)
else:
raise NotImplementedError(f'There is no ddim discretization method called "{ddim_discr_method}"')
# assert ddim_timesteps.shape[0] == num_ddim_timesteps
# add one to get the final alpha values right (the ones from first scale to data during sampling)
steps_out = ddim_timesteps + 1
if verbose:
logging.info(f'Selected timesteps for ddim sampler: {steps_out}')
return steps_outView on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use one of the supported names: 'linear', 'quad', 'cosine', 'sqrt_linear', 'sqrt', 'squaredcos_cap_v2' (and their variants as implemented)
- Read the schedule string from the checkpoint config and map it to the closest supported schedule rather than inventing one
- Normalize the string (lowercase, strip) before dispatch
Example fix
# before
betas = make_beta_schedule('cosine-beta', 1000)
# after
betas = make_beta_schedule('cosine', 1000) Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {'linear', 'quad', 'cosine', 'cosine_linear', 'squaredcos_cap_v2', 'sqrt_linear', 'sqrt'}
if schedule not in SUPPORTED:
raise ValueError(f"unsupported schedule {schedule!r}; supported: {sorted(SUPPORTED)}")
betas = make_beta_schedule(schedule, n_timestep) Type guard
def is_supported_schedule(name: str) -> bool:
return name in {'linear', 'quad', 'cosine', 'cosine_linear', 'squaredcos_cap_v2', 'sqrt_linear', 'sqrt'} Prevention
- Map schedule names from external configs to this implementation's names at the adapter boundary
- Lowercase and strip schedule strings before dispatch
When it happens
Trigger: Calling make_beta_schedule('linear-beta') or passing a config's schedule field verbatim when it contains a name this implementation doesn't have (e.g. 'sigmoid' or a typo).
Common situations: Porting diffusion configs between codebases (compvis/diffusers/custom) with differing schedule naming; typos in hand-written sampler configs; renamed schedules across versions.
Related errors
- error invalid scheduler {scheduler_name}
- Unknown rope_img: {rope_img}
- Unsupported spatial_scale {scale}. Choose from {list(mapping
- Invalid {cls.__name__} string: '{value}'. Valid values are:
- Invalid normalization type: {normtype}
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/dca7ef91463ab761.
Report an issue: GitHub.