Commit 0cbefefa authored by William Berman's avatar William Berman Committed by Will Berman
Browse files

clamp comment @sayakpaul

parent 1875c35a
...@@ -214,6 +214,8 @@ class DDPMScheduler(SchedulerMixin, ConfigMixin): ...@@ -214,6 +214,8 @@ class DDPMScheduler(SchedulerMixin, ConfigMixin):
# and sample from it to get previous sample # and sample from it to get previous sample
# x_{t-1} ~ N(pred_prev_sample, variance) == add variance to pred_sample # x_{t-1} ~ N(pred_prev_sample, variance) == add variance to pred_sample
variance = (1 - alpha_prod_t_prev) / (1 - alpha_prod_t) * current_beta_t variance = (1 - alpha_prod_t_prev) / (1 - alpha_prod_t) * current_beta_t
# we always take the log of variance, so clamp it to ensure it's not 0
variance = torch.clamp(variance, min=1e-20) variance = torch.clamp(variance, min=1e-20)
if variance_type is None: if variance_type is None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment