aboutsummaryrefslogtreecommitdiff
path: root/modules/sd_samplers.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-01-05 10:33:51 +0300
committerGitHub <noreply@github.com>2023-01-05 10:33:51 +0300
commitc53852e257a1fd7daa5f6a8415d17645d5ffef87 (patch)
treefcda7de7736fde0b376aa86b09c2b90b23333608 /modules/sd_samplers.py
parent24e21c07108c0691636c0a54bf3936b847102330 (diff)
parent03f486a2399df0a2b24c7aeea72e64f106a87297 (diff)
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.py5
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