huggingface/diffusion-models-class

unit1/02_diffusion_models_from_scratch.ipynb typo in formulas

mnslarcher opened this issue · 0 comments

Hi! I think a typo fixed in notebook 01 wasn't fixed in notebook 02,

q(xt | x0) ~ N(sqrt(1-alpha)*x0, sqrt(1-alpha)*I)

should be

q(xt | x0) ~ N(sqrt(1-alpha)*x0, 1-alpha*I).

For the same reason, instead of

"and add noise scaled by beta_t"

should be

"and add noise scaled by sqrt(beta_t)"

because the noise should be scaled with the std. dev., not the variance.

Or in other terms

q(xt | x0) ~ N(sqrt(1-beta)*x0, beta*I) => q(xt | x0) = sqrt(1-beta) * x0 + sqrt(beta) * e

with e ~ N(0, I),

var(sqrt(1-beta) * x0 + sqrt(beta) * e) = var(sqrt(beta) * e) = beta * var(e) = beta * I.

This second typo is still in notebook 01 too.

Do you think this makes sense?

Sorry if I'm missing something here and thanks for the great course!