crowsonkb / k-diffusion

Karras et al. (2022) diffusion models for PyTorch
MIT License
2.21k stars 371 forks source link

fix: DPM-Solver++(2m & 3M) SDE. #104

Open davertor opened 3 months ago

davertor commented 3 months ago

When using the stable diffusion webui with "DPM++ 3M SDE Karras", some of the boundary conditions result in the following error:

      File "/stable-diffusion-webui/repositories/k-diffusion/k_diffusion/sampling.py", line 700, in sample_dpmpp_3m_sde
        h_1, h_2 = h, h_1
    UnboundLocalError: local variable 'h' referenced before assignment

Checking the code, it seems that the indentation of the last part of sample_dpmpp_2m_sde and sample_dpmpp_3m_sde functions were wrong, and that's why h var was not defined in both samplers.