Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
0cbefefa
Commit
0cbefefa
authored
Apr 07, 2023
by
William Berman
Committed by
Will Berman
Apr 09, 2023
Browse files
clamp comment @sayakpaul
parent
1875c35a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/diffusers/schedulers/scheduling_ddpm.py
src/diffusers/schedulers/scheduling_ddpm.py
+2
-0
No files found.
src/diffusers/schedulers/scheduling_ddpm.py
View file @
0cbefefa
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment