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
2f997f30
Unverified
Commit
2f997f30
authored
May 23, 2023
by
Isotr0py
Committed by
GitHub
May 23, 2023
Browse files
Fix bug in panorama pipeline when using dpmsolver scheduler (#3499)
fix panorama pipeline with dpmsolver scheduler
parent
67cd4601
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py
...es/stable_diffusion/pipeline_stable_diffusion_panorama.py
+17
-4
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py
View file @
2f997f30
...
@@ -612,6 +612,7 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
...
@@ -612,6 +612,7 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
# 6. Define panorama grid and initialize views for synthesis.
# 6. Define panorama grid and initialize views for synthesis.
views
=
self
.
get_views
(
height
,
width
)
views
=
self
.
get_views
(
height
,
width
)
blocks_model_outputs
=
[
None
]
*
len
(
views
)
count
=
torch
.
zeros_like
(
latents
)
count
=
torch
.
zeros_like
(
latents
)
value
=
torch
.
zeros_like
(
latents
)
value
=
torch
.
zeros_like
(
latents
)
...
@@ -632,7 +633,7 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
...
@@ -632,7 +633,7 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
# denoised (latent) crops are then averaged to produce the final latent
# denoised (latent) crops are then averaged to produce the final latent
# for the current timestep via MultiDiffusion. Please see Sec. 4.1 in the
# for the current timestep via MultiDiffusion. Please see Sec. 4.1 in the
# MultiDiffusion paper for more details: https://arxiv.org/abs/2302.08113
# MultiDiffusion paper for more details: https://arxiv.org/abs/2302.08113
for
h_start
,
h_end
,
w_start
,
w_end
in
views
:
for
j
,
(
h_start
,
h_end
,
w_start
,
w_end
)
in
enumerate
(
views
)
:
# get the latents corresponding to the current view coordinates
# get the latents corresponding to the current view coordinates
latents_for_view
=
latents
[:,
:,
h_start
:
h_end
,
w_start
:
w_end
]
latents_for_view
=
latents
[:,
:,
h_start
:
h_end
,
w_start
:
w_end
]
...
@@ -656,6 +657,18 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
...
@@ -656,6 +657,18 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
noise_pred
=
noise_pred_uncond
+
guidance_scale
*
(
noise_pred_text
-
noise_pred_uncond
)
# compute the previous noisy sample x_t -> x_t-1
# compute the previous noisy sample x_t -> x_t-1
if
hasattr
(
self
.
scheduler
,
"model_outputs"
):
# rematch model_outputs in each block
if
i
>=
1
:
self
.
scheduler
.
model_outputs
=
blocks_model_outputs
[
j
]
latents_view_denoised
=
self
.
scheduler
.
step
(
noise_pred
,
t
,
latents_for_view
,
**
extra_step_kwargs
).
prev_sample
# collect model_outputs
blocks_model_outputs
[
j
]
=
[
output
if
output
is
not
None
else
None
for
output
in
self
.
scheduler
.
model_outputs
]
else
:
latents_view_denoised
=
self
.
scheduler
.
step
(
latents_view_denoised
=
self
.
scheduler
.
step
(
noise_pred
,
t
,
latents_for_view
,
**
extra_step_kwargs
noise_pred
,
t
,
latents_for_view
,
**
extra_step_kwargs
).
prev_sample
).
prev_sample
...
...
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