Skip to content

Formulation of reverse diffusion process in DDPM ( 1 - alpha_prod_t = beta_prod_t assumption) #9474

@jadevaibhav

Description

@jadevaibhav

Describe the bug

I looked into sampling code of DDPM, and I believe there's a mistake:

I believe the code makes assumption that 1 - alpha_prod_t = beta_prod_t, which simply isn't true.

Original sampling algorithm:
original paper
image

x_0 prediction from sample and predicted noise :

Eqn 15 from paper, as referenced in code snippet as well:
Screenshot 2024-09-19 at 6 26 48 PM

code implementation in diffusers:

# 2. compute predicted original sample from predicted noise also called
# "predicted x_0" of formula (15) from https://arxiv.org/pdf/2006.11239.pdf
if self.config.prediction_type == "epsilon":
pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)

Here, it clearly seems like the 1 - alpha_prod_t = beta_prod_t is being used.

investigated from post by @AlejandroBaron in #9431_

Reproduction

I haven't tested out code, but this seems fundamental formulation issue.

Logs

No response

System Info

0.30.3

Who can help?

@sayakpaul @DN6 @yiy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssues that haven't received updates

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions