vvictoryuki / FreeDoM

[ICCV 2023] Official PyTorch implementation for the paper "FreeDoM: Training-Free Energy-Guided Conditional Diffusion Model"
260 stars 9 forks source link

A question on Eq.(1) in the paper #4

Closed xjtupanda closed 1 year ago

xjtupanda commented 1 year ago

Thanks for sharing the great work! I'm not sure where the formula is from, I've checked the cited paper "Denoising diffusion probabilistic models", which presents a different formulation. It's also different from the Langevin dynamics sampling formula, could you please clarify this?

vvictoryuki commented 1 year ago

@xjtupanda Thanks for your attention! For deriving Eq.1, we first get the SDE sampling formula in a discrete form: $\mathbf{x}_{t-1}=\mathbf{x}_{t}-[f(\mathbf{x}_t, t)-g^2(t)\nabla_{\mathbf{x}_t}\log p(\mathbf{x}_t)]+g(t)\boldsymbol{\epsilon}$ Then we use the setting of DDPM ($f(\mathbf{x}_t, t)=-\frac{1}{2}\beta_t$, $g(t)=\sqrt{\beta_t}$) to get the Eq.1: $\mathbf{x}_{t-1}=(1+\frac{1}{2}\beta_t)\mathbf{x}_t+\beta_t\nabla_{\mathbf{x}_t}\log p(\mathbf{x}_t) + \sqrt{\beta_t}\boldsymbol{\epsilon}$ This Chinese video about SDE sampling formula derivation may further help you:)