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
OpenDAS
diffusers
Commits
27150793
Unverified
Commit
27150793
authored
Jun 15, 2023
by
cmdr2
Committed by
GitHub
Jun 15, 2023
Browse files
Fix broken cpu-offloading in legacy inpainting SD pipeline (#3773)
parent
1ae15fa6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
...ble_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
+3
-3
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
View file @
27150793
...
...
@@ -548,7 +548,7 @@ class StableDiffusionInpaintPipelineLegacy(
return
timesteps
,
num_inference_steps
-
t_start
def
prepare_latents
(
self
,
image
,
timestep
,
num_images_per_prompt
,
dtype
,
device
,
generator
):
image
=
image
.
to
(
device
=
self
.
device
,
dtype
=
dtype
)
image
=
image
.
to
(
device
=
device
,
dtype
=
dtype
)
init_latent_dist
=
self
.
vae
.
encode
(
image
).
latent_dist
init_latents
=
init_latent_dist
.
sample
(
generator
=
generator
)
init_latents
=
self
.
vae
.
config
.
scaling_factor
*
init_latents
...
...
@@ -558,7 +558,7 @@ class StableDiffusionInpaintPipelineLegacy(
init_latents_orig
=
init_latents
# add noise to latents using the timesteps
noise
=
randn_tensor
(
init_latents
.
shape
,
generator
=
generator
,
device
=
self
.
device
,
dtype
=
dtype
)
noise
=
randn_tensor
(
init_latents
.
shape
,
generator
=
generator
,
device
=
device
,
dtype
=
dtype
)
init_latents
=
self
.
scheduler
.
add_noise
(
init_latents
,
noise
,
timestep
)
latents
=
init_latents
return
latents
,
init_latents_orig
,
noise
...
...
@@ -710,7 +710,7 @@ class StableDiffusionInpaintPipelineLegacy(
)
# 7. Prepare mask latent
mask
=
mask_image
.
to
(
device
=
self
.
device
,
dtype
=
latents
.
dtype
)
mask
=
mask_image
.
to
(
device
=
device
,
dtype
=
latents
.
dtype
)
mask
=
torch
.
cat
([
mask
]
*
num_images_per_prompt
)
# 8. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
...
...
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