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
a3efa433
Unverified
Commit
a3efa433
authored
Oct 18, 2022
by
Hamish Friedlander
Committed by
GitHub
Oct 18, 2022
Browse files
Fix DDIM on Windows not using int64 for timesteps (#819)
parent
728a3f3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/diffusers/schedulers/scheduling_ddim.py
src/diffusers/schedulers/scheduling_ddim.py
+2
-2
No files found.
src/diffusers/schedulers/scheduling_ddim.py
View file @
a3efa433
...
...
@@ -149,7 +149,7 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
# setable values
self
.
num_inference_steps
=
None
self
.
timesteps
=
torch
.
from_numpy
(
np
.
arange
(
0
,
num_train_timesteps
)[::
-
1
].
copy
())
self
.
timesteps
=
torch
.
from_numpy
(
np
.
arange
(
0
,
num_train_timesteps
)[::
-
1
].
copy
()
.
astype
(
np
.
int64
)
)
def
scale_model_input
(
self
,
sample
:
torch
.
FloatTensor
,
timestep
:
Optional
[
int
]
=
None
)
->
torch
.
FloatTensor
:
"""
...
...
@@ -192,7 +192,7 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
step_ratio
=
self
.
config
.
num_train_timesteps
//
self
.
num_inference_steps
# creates integer timesteps by multiplying by ratio
# casting to int to avoid issues when num_inference_step is power of 3
timesteps
=
(
np
.
arange
(
0
,
num_inference_steps
)
*
step_ratio
).
round
()[::
-
1
].
copy
()
timesteps
=
(
np
.
arange
(
0
,
num_inference_steps
)
*
step_ratio
).
round
()[::
-
1
].
copy
()
.
astype
(
np
.
int64
)
self
.
timesteps
=
torch
.
from_numpy
(
timesteps
).
to
(
device
)
self
.
timesteps
+=
offset
...
...
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