samplers add custom sigma

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2024-12-03 08:52:53 -05:00
parent bd192d2991
commit e3f06734d0
3 changed files with 17 additions and 1 deletions
+1
View File
@@ -68,6 +68,7 @@
- **OpenVINO**: update to 2024.5.0
- **Sampler** improvements
- Euler FlowMatch: add sigma methods (*karras/exponential/betas*)
- Euler FlowMatch: allow using timestep presets to set sigmas
- DPM FlowMatch: update all and add sigma methods
- BDIA-DDIM: *experimental*
+1 -1
View File
@@ -459,7 +459,7 @@ def check_python(supported_minors=[9, 10, 11, 12], reason=None):
def check_diffusers():
if args.skip_all or args.skip_requirements:
return
sha = 'c96bfa5c80eca798d555a79a491043c311d0f608'
sha = '63b631f38336f56755fb5cf15d9b0fb70bbf6323' # diffusers commit hash
pkg = pkg_resources.working_set.by_key.get('diffusers', None)
minor = int(pkg.version.split('.')[1] if pkg is not None else 0)
cur = opts.get('diffusers_version', '') if minor > 0 else ''
+15
View File
@@ -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