1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-29 07:22:12 +03:00

clamp comment @sayakpaul

This commit is contained in:
William Berman
2023-04-07 11:49:53 -07:00
committed by Will Berman
parent 1875c35aeb
commit 0cbefefac3

View File

@@ -214,6 +214,8 @@ class DDPMScheduler(SchedulerMixin, ConfigMixin):
# and sample from it to get previous 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
# we always take the log of variance, so clamp it to ensure it's not 0
variance = torch.clamp(variance, min=1e-20)
if variance_type is None: