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 /modules/sd_samplers.py | |
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
Diffstat (limited to 'modules/sd_samplers.py')
-rw-r--r-- | modules/sd_samplers.py | 5 |
1 files changed, 4 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
|