mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-08 05:12:35 +00:00
updates for the noise schedule settings
This commit is contained in:
@@ -321,25 +321,27 @@ class KDiffusionSampler:
|
||||
sigmas = p.sampler_noise_scheduler_override(steps)
|
||||
elif opts.k_sched_type != "Automatic":
|
||||
m_sigma_min, m_sigma_max = (self.model_wrap.sigmas[0].item(), self.model_wrap.sigmas[-1].item())
|
||||
sigma_min, sigma_max = (0.1, 10)
|
||||
sigma_min, sigma_max = (0.1, 10) if opts.use_old_karras_scheduler_sigmas else (m_sigma_min, m_sigma_max)
|
||||
sigmas_kwargs = {
|
||||
'sigma_min': sigma_min if opts.use_old_karras_scheduler_sigmas else m_sigma_min,
|
||||
'sigma_max': sigma_max if opts.use_old_karras_scheduler_sigmas else m_sigma_max
|
||||
'sigma_min': sigma_min,
|
||||
'sigma_max': sigma_max,
|
||||
}
|
||||
|
||||
sigmas_func = k_diffusion_scheduler[opts.k_sched_type]
|
||||
p.extra_generation_params["KDiff Schedule Type"] = opts.k_sched_type
|
||||
p.extra_generation_params["Schedule type"] = opts.k_sched_type
|
||||
|
||||
if opts.sigma_min != 0.3:
|
||||
# take 0.0 as model default
|
||||
sigmas_kwargs['sigma_min'] = opts.sigma_min or m_sigma_min
|
||||
p.extra_generation_params["KDiff Schedule min sigma"] = opts.sigma_min
|
||||
if opts.sigma_max != 14.6:
|
||||
sigmas_kwargs['sigma_max'] = opts.sigma_max or m_sigma_max
|
||||
p.extra_generation_params["KDiff Schedule max sigma"] = opts.sigma_max
|
||||
if opts.k_sched_type != 'exponential':
|
||||
if opts.sigma_min != m_sigma_min and opts.sigma_min != 0:
|
||||
sigmas_kwargs['sigma_min'] = opts.sigma_min
|
||||
p.extra_generation_params["Schedule min sigma"] = opts.sigma_min
|
||||
if opts.sigma_max != m_sigma_max and opts.sigma_max != 0:
|
||||
sigmas_kwargs['sigma_max'] = opts.sigma_max
|
||||
p.extra_generation_params["Schedule max sigma"] = opts.sigma_max
|
||||
|
||||
default_rho = 1. if opts.k_sched_type == "polyexponential" else 7.
|
||||
|
||||
if opts.k_sched_type != 'exponential' and opts.rho != 0 and opts.rho != default_rho:
|
||||
sigmas_kwargs['rho'] = opts.rho
|
||||
p.extra_generation_params["KDiff Schedule rho"] = opts.rho
|
||||
p.extra_generation_params["Schedule rho"] = opts.rho
|
||||
|
||||
sigmas = sigmas_func(n=steps, **sigmas_kwargs, device=shared.device)
|
||||
elif self.config is not None and self.config.options.get('scheduler', None) == 'karras':
|
||||
|
Reference in New Issue
Block a user