GuernikaCore / Schedulers

Apache License 2.0
7 stars 7 forks source link

DPM sampler problem #3

Open czkoko opened 9 months ago

czkoko commented 9 months ago

@GuiyeC Is the DPM++ SDE Karras algorithm of this project different from other's DPM++ SDE Karras algorithms such as ComfyUI?

DPM++ 2m Karras also has problem. For the turbo model, DPM++ SDE Karras seems to work normally, but in comparison, it requires 2-3 more steps.

nosferatu500 commented 9 months ago

Just found this repo... I think this might help: https://github.com/huggingface/diffusers/pull/6477/files

czkoko commented 9 months ago

Just found this repo... I think this might help: https://github.com/huggingface/diffusers/pull/6477/files

@GuiyeC @nosferatu500 This seems to be the key to the problem. The picture quality problems encountered by DPM++2M Karras are the same. DPM++ SDE Karras seem to have some differences, and the picture will become hazy.

nosferatu500 commented 9 months ago

I'm also using the diffuser repo as a reference for implementing pipeline and schedulers for my own app, but I'm still working with v0.9 (started with v0.3) and v0.26 is too many changes for me, so I don't know if any more changes are needed except for this commit, so I can't do a PR. (yet), but I noticed this commit a while ago.

czkoko commented 8 months ago

The algorithm used by DrawThings produces very good picture quality. I don't know if can refer to it. https://github.com/liuliu/swift-diffusion/blob/1f0b2acead80ae98665c0235083893c7fa6da7e5/examples/sdxl_txt2img/main.swift#L719

czkoko commented 8 months ago

I made the following changes, but it didn't improve the picture quality.

karrasSigmas.append(karrasSigmas.last!)  => karrasSigmas.append(0)
czkoko commented 8 months ago

Guernikakit, DPM++ 2M Karras, SDXL, 15 steps: guernika

DrawThings, DPM++ 2M Karras, SDXL, 15 steps: drawthings

nosferatu500 commented 8 months ago

I'm not sure, but maybe the problem is with the convertToKarras fun? I can't check it myself, but if I remember correctly, the implementation of the func in Guernika and the ml-stable-diffusion repo is different. But I don't know where the correct one, so... I would look at the implementation in the diffusers repo.

czkoko commented 8 months ago

@GuiyeC I found some reasons:

czkoko commented 8 months ago

I'm not sure, but maybe the problem is with the convertToKarras fun? I can't check it myself, but if I remember correctly, the implementation of the func in Guernika and the ml-stable-diffusion repo is different. But I don't know where the correct one, so... I would look at the implementation in the diffusers repo.

It is the same as the algorithm of ml-stable-diffusion, just do some code refactoring and optimization.

czkoko commented 8 months ago