Unverified Commit 5667ec4c authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub

Merge pull request #5797 from mcmonkey4eva/dpm2-a-fix

Add a workaround patch for DPM2 a issue
parents 0fdf368a 7ba9bc2f
......@@ -454,6 +454,9 @@ class KDiffusionSampler:
else:
sigmas = self.model_wrap.get_sigmas(steps)
if self.funcname in ['sample_dpm_2_ancestral', 'sample_dpm_2']:
sigmas = torch.cat([sigmas[:-2], sigmas[-1:]])
sigma_sched = sigmas[steps - t_enc - 1:]
xi = x + noise * sigma_sched[0]
......@@ -494,6 +497,9 @@ class KDiffusionSampler:
x = x * sigmas[0]
if self.funcname in ['sample_dpm_2_ancestral', 'sample_dpm_2']:
sigmas = torch.cat([sigmas[:-2], sigmas[-1:]])
extra_params_kwargs = self.initialize(p)
if 'sigma_min' in inspect.signature(self.func).parameters:
extra_params_kwargs['sigma_min'] = self.model_wrap.sigmas[0].item()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment