keras-team / keras-cv

Industry-strength Computer Vision workflows with Keras
Other
1.01k stars 330 forks source link

NoiseScheduler parameters for StableDiffusion are wrong #2049

Open DaniyarM opened 1 year ago

DaniyarM commented 1 year ago

NoiseScheduler https://github.com/keras-team/keras-cv/blob/master/keras_cv/models/stable_diffusion/noise_scheduler.py contains a bug with default parameters. For a pretrained SD it must be: NoiseScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule='scaled_linear', clip_sample=False). For now it is: NoiseScheduler(beta_start=0.0001, beta_end=0.02, beta_schedule='linear', clip_sample=True). As I understand it, this happened because of copy-paste with a hugging face (where the default parameters are taken for some old GANs).

jbischof commented 1 year ago

Thanks @DaniyarM! Can you share the source of the corrected parameters?

DaniyarM commented 1 year ago

It can be obtained from huggingface's diffusers like that : from diffusers import DDIMScheduler scheduler = DDIMScheduler.from_pretrained('runwayml/stable-diffusion-v1-5', subfolder='scheduler') print(scheduler)

Also, it can be found in that article: https://arxiv.org/pdf/2305.08891v2.pdf (Table 1).

ianstenbit commented 1 year ago

Thanks @DaniyarM for pointing this out -- feel free to send a PR to update this!