mirror of
https://github.com/vladmandic/automatic
synced 2026-09-17 16:24:33 +02:00
samplers add custom sigma
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -186,6 +186,21 @@ def set_pipeline_args(p, model, prompts: list, negative_prompts: list, prompts_2
|
||||
shared.log.error(f'Sampler timesteps: {e}')
|
||||
else:
|
||||
shared.log.warning(f'Sampler: sampler={model.scheduler.__class__.__name__} timesteps not supported')
|
||||
if 'sigmas' in possible:
|
||||
sigmas = re.split(',| ', shared.opts.schedulers_timesteps)
|
||||
sigmas = [float(x)/1000.0 for x in sigmas if x.isdigit()]
|
||||
if len(sigmas) > 0:
|
||||
if hasattr(model.scheduler, 'set_timesteps') and "sigmas" in set(inspect.signature(model.scheduler.set_timesteps).parameters.keys()):
|
||||
try:
|
||||
args['sigmas'] = sigmas
|
||||
p.steps = len(sigmas)
|
||||
p.timesteps = sigmas
|
||||
steps = p.steps
|
||||
shared.log.debug(f'Sampler: steps={len(sigmas)} sigmas={sigmas}')
|
||||
except Exception as e:
|
||||
shared.log.error(f'Sampler sigmas: {e}')
|
||||
else:
|
||||
shared.log.warning(f'Sampler: sampler={model.scheduler.__class__.__name__} sigmas not supported')
|
||||
|
||||
if hasattr(model, 'scheduler') and hasattr(model.scheduler, 'noise_sampler_seed') and hasattr(model.scheduler, 'noise_sampler'):
|
||||
model.scheduler.noise_sampler = None # noise needs to be reset instead of using cached values
|
||||
|
||||
Reference in New Issue
Block a user