diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-01-05 07:33:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 07:33:51 +0000 |
commit | c53852e257a1fd7daa5f6a8415d17645d5ffef87 (patch) | |
tree | fcda7de7736fde0b376aa86b09c2b90b23333608 | |
parent | 24e21c07108c0691636c0a54bf3936b847102330 (diff) | |
parent | 03f486a2399df0a2b24c7aeea72e64f106a87297 (diff) | |
download | stable-diffusion-webui-gfx803-c53852e257a1fd7daa5f6a8415d17645d5ffef87.tar.gz stable-diffusion-webui-gfx803-c53852e257a1fd7daa5f6a8415d17645d5ffef87.tar.bz2 stable-diffusion-webui-gfx803-c53852e257a1fd7daa5f6a8415d17645d5ffef87.zip |
Merge pull request #6044 from hentailord85ez/discard-penultimate-sigma
Allow always discarding of penultimate sigma and fix doing 1 less step than specified
-rw-r--r-- | modules/sd_samplers.py | 5 | ||||
-rw-r--r-- | modules/shared.py | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py index 3851a77f..31b255a3 100644 --- a/modules/sd_samplers.py +++ b/modules/sd_samplers.py @@ -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
diff --git a/modules/shared.py b/modules/shared.py index 04c545ee..e0f44c6d 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -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"), {
|