{"record":{"id":"eb284eff0909ed4f","repo":"Comfy-Org/ComfyUI","slug":"unsupported-noise-schedule-the-schedule-needs","errorCode":null,"errorMessage":"Unsupported noise schedule {}. The schedule needs to be 'discrete' or 'linear' or 'cosine'","messagePattern":"Unsupported noise schedule (.+?)\\. The schedule needs to be 'discrete' or 'linear' or 'cosine'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/extra_samplers/uni_pc.py","lineNumber":100,"sourceCode":"            A wrapper object of the forward SDE (VP type).\n\n        ===============================================================\n\n        Example:\n\n        # For discrete-time DPMs, given betas (the beta array for n = 0, 1, ..., N - 1):\n        >>> ns = NoiseScheduleVP('discrete', betas=betas)\n\n        # For discrete-time DPMs, given alphas_cumprod (the \\hat{alpha_n} array for n = 0, 1, ..., N - 1):\n        >>> ns = NoiseScheduleVP('discrete', alphas_cumprod=alphas_cumprod)\n\n        # For continuous-time DPMs (VPSDE), linear schedule:\n        >>> ns = NoiseScheduleVP('linear', continuous_beta_0=0.1, continuous_beta_1=20.)\n\n        \"\"\"\n\n        if schedule not in ['discrete', 'linear', 'cosine']:\n            raise ValueError(\"Unsupported noise schedule {}. The schedule needs to be 'discrete' or 'linear' or 'cosine'\".format(schedule))\n\n        self.schedule = schedule\n        if schedule == 'discrete':\n            if betas is not None:\n                log_alphas = 0.5 * torch.log(1 - betas).cumsum(dim=0)\n            else:\n                assert alphas_cumprod is not None\n                log_alphas = 0.5 * torch.log(alphas_cumprod)\n            self.total_N = len(log_alphas)\n            self.T = 1.\n            self.t_array = torch.linspace(0., 1., self.total_N + 1)[1:].reshape((1, -1))\n            self.log_alpha_array = log_alphas.reshape((1, -1,))\n        else:\n            self.total_N = 1000\n            self.beta_0 = continuous_beta_0\n            self.beta_1 = continuous_beta_1\n            self.cosine_s = 0.008\n            self.cosine_beta_max = 999.","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/extra_samplers/uni_pc.py#L82-L118","documentation":"NoiseScheduleVP (the DPM-Solver schedule used by the uni_pc extra sampler) only implements three schedule types: 'discrete' (from betas or alphas_cumprod), 'linear' (continuous VPSDE), and 'cosine'. The constructor validates the schedule string and raises ValueError for anything else, because log-alpha computation differs per schedule and there is no generic fallback.","triggerScenarios":"Constructing NoiseScheduleVP('polynomial', ...) or with a typo ('Discrete', 'linear '); calling uni_pc sampling on a model whose noise-schedule metadata yields a string outside the three allowed values; custom samplers passing their own schedule names through.","commonSituations":"Adapting the uni_pc sampler to a new model family whose betas come from a different parameterization; passing model.predicted_info string directly; case/whitespace mismatches.","solutions":["Use one of 'discrete', 'linear', 'cosine'.","If you have raw betas/alphas_cumprod from the model, pass schedule='discrete' with betas= or alphas_cumprod=.","Normalize the string: s.strip().lower() before constructing.","For truly different schedules, precompute log_alphas yourself instead of relying on NoiseScheduleVP."],"exampleFix":"# before\nns = NoiseScheduleVP('discrete ')\n\n# after\nbetas = model_betas  # from your diffusion model\nns = NoiseScheduleVP('discrete', betas=betas)","handlingStrategy":"validation","validationCode":"schedule = schedule.strip().lower()\nif schedule not in (\"discrete\", \"linear\", \"cosine\"):\n    raise SystemExit(\"schedule must be discrete, linear, or cosine\")\nns = NoiseScheduleVP(schedule, betas=betas)","typeGuard":"def is_valid_schedule(name: str) -> bool:\n    return name.strip().lower() in (\"discrete\", \"linear\", \"cosine\")","tryCatchPattern":"try:\n    ns = NoiseScheduleVP(schedule, betas=betas)\nexcept ValueError:\n    ns = NoiseScheduleVP(\"discrete\", betas=betas)  # known-safe path for raw betas","preventionTips":["Normalize schedule strings (strip/lower) before constructing NoiseScheduleVP.","When you hold raw betas or alphas_cumprod, always use 'discrete'."],"tags":["sampling","uni-pc","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}