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
b50a9ae3
Commit
b50a9ae3
authored
Aug 16, 2022
by
Patrick von Platen
Browse files
[Stable diffusion] Hot fix
parent
ea2e177c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
...s/pipelines/stable_diffusion/pipeline_stable_diffusion.py
+4
-4
src/diffusers/schedulers/scheduling_lms_discrete.py
src/diffusers/schedulers/scheduling_lms_discrete.py
+2
-2
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
View file @
b50a9ae3
...
@@ -96,6 +96,10 @@ class StableDiffusionPipeline(DiffusionPipeline):
...
@@ -96,6 +96,10 @@ class StableDiffusionPipeline(DiffusionPipeline):
self
.
scheduler
.
set_timesteps
(
num_inference_steps
,
**
extra_set_kwargs
)
self
.
scheduler
.
set_timesteps
(
num_inference_steps
,
**
extra_set_kwargs
)
# if we use LMSDiscreteScheduler, let's make sure latents are mulitplied by sigmas
if
isinstance
(
self
.
scheduler
,
LMSDiscreteScheduler
):
latents
=
latents
*
self
.
scheduler
.
sigmas
[
0
]
# prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
# prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
# eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
# eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
# eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
# eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
...
@@ -105,10 +109,6 @@ class StableDiffusionPipeline(DiffusionPipeline):
...
@@ -105,10 +109,6 @@ class StableDiffusionPipeline(DiffusionPipeline):
if
accepts_eta
:
if
accepts_eta
:
extra_step_kwargs
[
"eta"
]
=
eta
extra_step_kwargs
[
"eta"
]
=
eta
self
.
scheduler
.
set_timesteps
(
num_inference_steps
)
if
isinstance
(
self
.
scheduler
,
LMSDiscreteScheduler
):
latents
=
latents
*
self
.
scheduler
.
sigmas
[
0
]
for
i
,
t
in
tqdm
(
enumerate
(
self
.
scheduler
.
timesteps
)):
for
i
,
t
in
tqdm
(
enumerate
(
self
.
scheduler
.
timesteps
)):
# expand the latents if we are doing classifier free guidance
# expand the latents if we are doing classifier free guidance
latent_model_input
=
torch
.
cat
([
latents
]
*
2
)
if
do_classifier_free_guidance
else
latents
latent_model_input
=
torch
.
cat
([
latents
]
*
2
)
if
do_classifier_free_guidance
else
latents
...
...
src/diffusers/schedulers/scheduling_lms_discrete.py
View file @
b50a9ae3
...
@@ -36,8 +36,8 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
...
@@ -36,8 +36,8 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
tensor_format
=
"pt"
,
tensor_format
=
"pt"
,
):
):
"""
"""
Linear Multistep Scheduler for discrete beta schedules.
Linear Multistep Scheduler for discrete beta schedules.
Based on the original k-diffusion implementation by
Based on the original k-diffusion implementation by
Katherine Crowson:
Katherine Crowson:
https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181
https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181
"""
"""
...
...
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