Skip to content

Commit fb42066

Browse files
GiusCatGiuseppe Catalano
and
Giuseppe Catalano
authored
Revert RePaint scheduler 'fix' (#10644)
Co-authored-by: Giuseppe Catalano <giuseppelorenzo.catalano@unito.it>
1 parent e89ab5b commit fb42066

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/diffusers/schedulers/scheduling_repaint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,11 @@ def step(
319319
prev_unknown_part = alpha_prod_t_prev**0.5 * pred_original_sample + pred_sample_direction + variance
320320

321321
# 8. Algorithm 1 Line 5 https://arxiv.org/pdf/2201.09865.pdf
322-
prev_known_part = (alpha_prod_t_prev**0.5) * original_image + (1 - alpha_prod_t_prev) * noise
322+
# The computation reported in Algorithm 1 Line 5 is incorrect. Line 5 refers to formula (8a) of the same paper,
323+
# which tells to sample from a Gaussian distribution with mean "(alpha_prod_t_prev**0.5) * original_image"
324+
# and variance "(1 - alpha_prod_t_prev)". This means that the standard Gaussian distribution "noise" should be
325+
# scaled by the square root of the variance (as it is done here), however Algorithm 1 Line 5 tells to scale by the variance.
326+
prev_known_part = (alpha_prod_t_prev**0.5) * original_image + ((1 - alpha_prod_t_prev) ** 0.5) * noise
323327

324328
# 9. Algorithm 1 Line 8 https://arxiv.org/pdf/2201.09865.pdf
325329
pred_prev_sample = mask * prev_known_part + (1.0 - mask) * prev_unknown_part

0 commit comments

Comments
 (0)