Merge pull request #6044 from hentailord85ez/discard-penultimate-sigma

Allow always discarding of penultimate sigma and fix doing 1 less step than specified
This commit is contained in:
AUTOMATIC1111 2023-01-05 10:33:51 +03:00 committed by GitHub
commit c53852e257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -463,6 +463,9 @@ class KDiffusionSampler:
return extra_params_kwargs
def get_sigmas(self, p, steps):
disc = opts.always_discard_next_to_last_sigma or (self.config is not None and self.config.options.get('discard_next_to_last_sigma', False))
steps += 1 if disc else 0
if p.sampler_noise_scheduler_override:
sigmas = p.sampler_noise_scheduler_override(steps)
elif self.config is not None and self.config.options.get('scheduler', None) == 'karras':
@ -472,7 +475,7 @@ class KDiffusionSampler:
else:
sigmas = self.model_wrap.get_sigmas(steps)
if self.config is not None and self.config.options.get('discard_next_to_last_sigma', False):
if disc:
sigmas = torch.cat([sigmas[:-2], sigmas[-1:]])
return sigmas

View File

@ -442,6 +442,7 @@ options_templates.update(options_section(('sampler-params', "Sampler parameters"
's_tmin': OptionInfo(0.0, "sigma tmin", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
's_noise': OptionInfo(1.0, "sigma noise", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
'eta_noise_seed_delta': OptionInfo(0, "Eta noise seed delta", gr.Number, {"precision": 0}),
'always_discard_next_to_last_sigma': OptionInfo(False, "Always discard next-to-last sigma"),
}))
options_templates.update(options_section((None, "Hidden options"), {