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
OpenDAS
diffusers
Commits
43bbc781
Commit
43bbc781
authored
Jul 15, 2022
by
Patrick von Platen
Browse files
adapt test
parent
1c14ce95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py
...tent_diffusion_uncond/pipeline_latent_diffusion_uncond.py
+4
-2
tests/test_modeling_utils.py
tests/test_modeling_utils.py
+2
-1
No files found.
src/diffusers/pipelines/latent_diffusion_uncond/pipeline_latent_diffusion_uncond.py
View file @
43bbc781
...
...
@@ -36,6 +36,7 @@ class LatentDiffusionUncondPipeline(DiffusionPipeline):
self
.
scheduler
.
set_timesteps
(
num_inference_steps
)
for
t
in
tqdm
.
tqdm
(
self
.
scheduler
.
timesteps
):
with
torch
.
no_grad
():
model_output
=
self
.
unet
(
image
,
t
)
if
isinstance
(
model_output
,
dict
):
...
...
@@ -46,5 +47,6 @@ class LatentDiffusionUncondPipeline(DiffusionPipeline):
image
=
self
.
scheduler
.
step
(
model_output
,
t
,
image
,
eta
)[
"prev_sample"
]
# decode image with vae
with
torch
.
no_grad
():
image
=
self
.
vqvae
.
decode
(
image
)
return
{
"sample"
:
image
}
tests/test_modeling_utils.py
View file @
43bbc781
...
...
@@ -1070,7 +1070,8 @@ class PipelineTesterMixin(unittest.TestCase):
@
slow
def
test_ldm_uncond
(
self
):
ldm
=
LatentDiffusionUncondPipeline
.
from_pretrained
(
"fusing/latent-diffusion-celeba-256"
,
ldm
=
True
)
# ldm = LatentDiffusionUncondPipeline.from_pretrained("fusing/latent-diffusion-celeba-256", ldm=True)
ldm
=
LatentDiffusionUncondPipeline
.
from_pretrained
(
"CompVis/latent-diffusion-celeba-256"
)
generator
=
torch
.
manual_seed
(
0
)
image
=
ldm
(
generator
=
generator
,
num_inference_steps
=
5
)[
"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