Commit 8b0703b8 authored by Alex "mcmonkey" Goodwin's avatar Alex "mcmonkey" Goodwin
Browse files

Add a workaround patch for DPM2 a issue

DPM2 a and DPM2 a Karras samplers are both affected by an issue described by https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/3483 and can be resolved by a workaround suggested by the k-diffusion author at https://github.com/crowsonkb/k-diffusion/issues/43#issuecomment-1305195666
parent 685f9631
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -494,6 +494,9 @@ class KDiffusionSampler:

        x = x * sigmas[0]

        if self.funcname == "sample_dpm_2_ancestral": # workaround dpm2 a issue
            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()