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
9bca4029
Unverified
Commit
9bca4029
authored
Oct 22, 2022
by
Kashif Rasul
Committed by
GitHub
Oct 22, 2022
Browse files
[MPS] fix mps failing tests (#934)
fix mps failing tests
parent
2fdd094c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
tests/test_models_vae.py
tests/test_models_vae.py
+15
-1
tests/test_pipelines.py
tests/test_pipelines.py
+7
-1
No files found.
tests/test_models_vae.py
View file @
9bca4029
...
@@ -106,7 +106,21 @@ class AutoencoderKLTests(ModelTesterMixin, unittest.TestCase):
...
@@ -106,7 +106,21 @@ class AutoencoderKLTests(ModelTesterMixin, unittest.TestCase):
# Since the VAE Gaussian prior's generator is seeded on the appropriate device,
# Since the VAE Gaussian prior's generator is seeded on the appropriate device,
# the expected output slices are not the same for CPU and GPU.
# the expected output slices are not the same for CPU and GPU.
if
torch_device
in
(
"mps"
,
"cpu"
):
if
torch_device
==
"mps"
:
expected_output_slice
=
torch
.
tensor
(
[
-
4.0078e-01
,
-
3.8323e-04
,
-
1.2681e-01
,
-
1.1462e-01
,
2.0095e-01
,
1.0893e-01
,
-
8.8247e-02
,
-
3.0361e-01
,
-
9.8644e-03
,
]
)
elif
torch_device
==
"cpu"
:
expected_output_slice
=
torch
.
tensor
(
expected_output_slice
=
torch
.
tensor
(
[
-
0.1352
,
0.0878
,
0.0419
,
-
0.0818
,
-
0.1069
,
0.0688
,
-
0.1458
,
-
0.4446
,
-
0.0026
]
[
-
0.1352
,
0.0878
,
0.0419
,
-
0.0818
,
-
0.1069
,
0.0688
,
-
0.1458
,
-
0.4446
,
-
0.0026
]
)
)
...
...
tests/test_pipelines.py
View file @
9bca4029
...
@@ -455,7 +455,13 @@ class PipelineFastTests(unittest.TestCase):
...
@@ -455,7 +455,13 @@ class PipelineFastTests(unittest.TestCase):
text2img
=
StableDiffusionPipeline
(
**
inpaint
.
components
).
to
(
torch_device
)
text2img
=
StableDiffusionPipeline
(
**
inpaint
.
components
).
to
(
torch_device
)
prompt
=
"A painting of a squirrel eating a burger"
prompt
=
"A painting of a squirrel eating a burger"
generator
=
torch
.
Generator
(
device
=
torch_device
).
manual_seed
(
0
)
# Device type MPS is not supported for torch.Generator() api.
if
torch_device
==
"mps"
:
generator
=
torch
.
manual_seed
(
0
)
else
:
generator
=
torch
.
Generator
(
device
=
torch_device
).
manual_seed
(
0
)
image_inpaint
=
inpaint
(
image_inpaint
=
inpaint
(
[
prompt
],
[
prompt
],
generator
=
generator
,
generator
=
generator
,
...
...
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