mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
fix(samplers): warn or raise when sampler lacks selected sigma method
The sigma-method override silently fell back to the sampler's default schedule when the selected method has no matching config key. Now warns and uses the default schedule with schedulers_fallback enabled, or raises like the other capability gates when it is disabled.
This commit is contained in:
@@ -427,20 +427,32 @@ class DiffusionSampler:
|
||||
timesteps = [int(x) for x in timesteps if x.isdigit()]
|
||||
sched_sigma = get_override('schedulers_sigma')
|
||||
if len(timesteps) == 0:
|
||||
sigma_applied = sched_sigma == 'default' # 'default' is always valid; track whether a chosen method actually applies
|
||||
if 'sigma_schedule' in self.config and sched_sigma != 'default':
|
||||
self.config['sigma_schedule'] = sched_sigma
|
||||
sigma_applied = True
|
||||
if sched_sigma == 'default' and shared.sd_model_type in flow_models and 'use_flow_sigmas' in self.config:
|
||||
self.config['use_flow_sigmas'] = True
|
||||
elif sched_sigma == 'betas' and 'use_beta_sigmas' in self.config:
|
||||
self.config['use_beta_sigmas'] = True
|
||||
sigma_applied = True
|
||||
elif sched_sigma == 'karras' and 'use_karras_sigmas' in self.config:
|
||||
self.config['use_karras_sigmas'] = True
|
||||
sigma_applied = True
|
||||
elif sched_sigma == 'flowmatch' and 'use_flow_sigmas' in self.config:
|
||||
self.config['use_flow_sigmas'] = True
|
||||
sigma_applied = True
|
||||
elif sched_sigma == 'exponential' and 'use_exponential_sigmas' in self.config:
|
||||
self.config['use_exponential_sigmas'] = True
|
||||
sigma_applied = True
|
||||
elif sched_sigma == 'lambdas' and 'use_lu_lambdas' in self.config:
|
||||
self.config['use_lu_lambdas'] = True
|
||||
sigma_applied = True
|
||||
if not sigma_applied:
|
||||
if debug or not shared.opts.schedulers_fallback:
|
||||
raise ValueError(f'Sampler: name="{name}" does not support sigma="{sched_sigma}"')
|
||||
else:
|
||||
log.warning(f'Sampler: name="{name}" does not support sigma="{sched_sigma}", using default schedule')
|
||||
else:
|
||||
pass # timesteps are set using set_timesteps in set_pipeline_args
|
||||
|
||||
|
||||
Reference in New Issue
Block a user