Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
diffusers
Commits
953c9d14
Commit
953c9d14
authored
Apr 04, 2023
by
William Berman
Committed by
Will Berman
Apr 10, 2023
Browse files
[bug fix] dpm multistep solver duplicate timesteps
parent
85f1c192
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
src/diffusers/schedulers/scheduling_dpmsolver_multistep.py
src/diffusers/schedulers/scheduling_dpmsolver_multistep.py
+9
-1
No files found.
src/diffusers/schedulers/scheduling_dpmsolver_multistep.py
View file @
953c9d14
...
@@ -192,14 +192,22 @@ class DPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
...
@@ -192,14 +192,22 @@ class DPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
device (`str` or `torch.device`, optional):
device (`str` or `torch.device`, optional):
the device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
the device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
"""
"""
self
.
num_inference_steps
=
num_inference_steps
timesteps
=
(
timesteps
=
(
np
.
linspace
(
0
,
self
.
num_train_timesteps
-
1
,
num_inference_steps
+
1
)
np
.
linspace
(
0
,
self
.
num_train_timesteps
-
1
,
num_inference_steps
+
1
)
.
round
()[::
-
1
][:
-
1
]
.
round
()[::
-
1
][:
-
1
]
.
copy
()
.
copy
()
.
astype
(
np
.
int64
)
.
astype
(
np
.
int64
)
)
)
# when num_inference_steps == num_train_timesteps, we can end up with
# duplicates in timesteps.
_
,
unique_indices
=
np
.
unique
(
timesteps
,
return_index
=
True
)
timesteps
=
timesteps
[
np
.
sort
(
unique_indices
)]
self
.
timesteps
=
torch
.
from_numpy
(
timesteps
).
to
(
device
)
self
.
timesteps
=
torch
.
from_numpy
(
timesteps
).
to
(
device
)
self
.
num_inference_steps
=
len
(
timesteps
)
self
.
model_outputs
=
[
self
.
model_outputs
=
[
None
,
None
,
]
*
self
.
config
.
solver_order
]
*
self
.
config
.
solver_order
...
...
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