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
cbbb2939
Commit
cbbb2939
authored
Oct 28, 2022
by
Patrick von Platen
Browse files
hot fix
parent
c4ef1efe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
tests/models/test_models_vae.py
tests/models/test_models_vae.py
+5
-5
No files found.
tests/models/test_models_vae.py
View file @
cbbb2939
...
...
@@ -20,7 +20,7 @@ import torch
from
diffusers
import
AutoencoderKL
from
diffusers.modeling_utils
import
ModelMixin
from
diffusers.utils
import
floats_tensor
,
require_torch_gpu
,
slow
,
torch_all_close
,
torch_device
from
diffusers.utils
import
floats_tensor
,
load_numpy
,
require_torch_gpu
,
slow
,
torch_all_close
,
torch_device
from
parameterized
import
parameterized
from
..test_modeling_common
import
ModelTesterMixin
...
...
@@ -136,6 +136,9 @@ class AutoencoderKLTests(ModelTesterMixin, unittest.TestCase):
@
slow
class
AutoencoderKLIntegrationTests
(
unittest
.
TestCase
):
def
get_file_format
(
self
,
seed
,
shape
):
return
f
"gaussian_noise_s=
{
seed
}
_shape=
{
'_'
.
join
([
str
(
s
)
for
s
in
shape
])
}
.npy"
def
tearDown
(
self
):
# clean up the VRAM after each test
super
().
tearDown
()
...
...
@@ -143,11 +146,8 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
torch
.
cuda
.
empty_cache
()
def
get_sd_image
(
self
,
seed
=
0
,
shape
=
(
4
,
3
,
512
,
512
),
fp16
=
False
):
batch_size
,
channels
,
height
,
width
=
shape
generator
=
torch
.
Generator
(
device
=
torch_device
).
manual_seed
(
seed
)
dtype
=
torch
.
float16
if
fp16
else
torch
.
float32
image
=
torch
.
randn
(
batch_size
,
channels
,
height
,
width
,
device
=
torch_device
,
generator
=
generator
,
dtype
=
dtype
)
image
=
torch
.
from_numpy
(
load_numpy
(
self
.
get_file_format
(
seed
,
shape
))).
to
(
torch_device
).
to
(
dtype
)
return
image
def
get_sd_vae_model
(
self
,
model_id
=
"CompVis/stable-diffusion-v1-4"
,
fp16
=
False
):
...
...
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