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

Add a workaround patch for DPM2 a issue
This commit is contained in:
AUTOMATIC1111 2022-12-24 08:51:43 +03:00 committed by GitHub
commit 5667ec4ca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()