stable-diffusion
stable-diffusion copied to clipboard
Why `make_beta_schedule` does not return linear schedule?
It seems that the beta schedule returned by make_beta_schedule("linear",...)
is not linear but quadratic. Instead, the returned beta is linear when schedule == "sqrt_linear"
. Why is it implemented in this way?
https://github.com/CompVis/stable-diffusion/blob/69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc/ldm/modules/diffusionmodules/util.py#L21-L43
Hi @yutoe05 Have you come across any explanations regarding this matter? I revisited the LDM paper and searched, but unfortunately, I haven't found any clarifications on the topic.
Hi wenhao728.
Unfortunately, I couldn't find any explanations.
Anyway, it seems they use linspace()**2
as default.
Hi @yutoe05,
For the fomula of generating x_{t} from x_{t-1}, the coefficient before noise is sqrt_beta_t. So I guess torch.linspace(linear_start ** 0.5, linear_end ** 0.5, n_timestep, dtype=torch.float64) ** 2
means add noise linearly.
Hi @newbie2niubility, I see. As you said, while originally in DDPM, the "noise schedule" is used with respect to the variance, it might be used with respect to the standard deviation of noise in latent diffusion. Thank you.