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
926b34b4
Commit
926b34b4
authored
Jan 22, 2023
by
Patrick von Platen
Browse files
improve tests
parent
8d326e61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
tests/pipelines/dit/test_dit.py
tests/pipelines/dit/test_dit.py
+2
-2
tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py
...le_diffusion/test_stable_diffusion_instruction_pix2pix.py
+2
-2
No files found.
tests/pipelines/dit/test_dit.py
View file @
926b34b4
...
...
@@ -111,7 +111,7 @@ class DiTPipelineIntegrationTests(unittest.TestCase):
expected_image
=
load_numpy
(
f
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/dit/
{
word
}
.npy"
)
assert
np
.
abs
((
expected_image
-
image
).
sum
())
<
1e-3
assert
np
.
abs
((
expected_image
-
image
).
abs
())
<
1e-3
def
test_dit_512_fp16
(
self
):
generator
=
torch
.
manual_seed
(
0
)
...
...
@@ -130,4 +130,4 @@ class DiTPipelineIntegrationTests(unittest.TestCase):
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
f
"/dit/
{
word
}
_fp16.npy"
)
assert
np
.
abs
((
expected_image
-
image
).
sum
())
<
1e-
3
assert
np
.
abs
((
expected_image
-
image
).
max
())
<
1e-
2
tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py
View file @
926b34b4
...
...
@@ -307,13 +307,13 @@ class StableDiffusionInstructPix2PixPipelineSlowTests(unittest.TestCase):
assert
latents
.
shape
==
(
1
,
4
,
64
,
64
)
latents_slice
=
latents
[
0
,
-
3
:,
-
3
:,
-
1
]
expected_slice
=
np
.
array
([
-
0.2388
,
-
0.4673
,
-
0.9775
,
1.5127
,
1.4414
,
0.7778
,
0.9907
,
0.8472
,
0.7788
])
assert
np
.
abs
(
latents_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-
3
assert
np
.
abs
(
latents_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-
2
elif
step
==
2
:
latents
=
latents
.
detach
().
cpu
().
numpy
()
assert
latents
.
shape
==
(
1
,
4
,
64
,
64
)
latents_slice
=
latents
[
0
,
-
3
:,
-
3
:,
-
1
]
expected_slice
=
np
.
array
([
-
0.2568
,
-
0.4648
,
-
0.9639
,
1.5137
,
1.4609
,
0.7603
,
0.9795
,
0.8403
,
0.7949
])
assert
np
.
abs
(
latents_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-
3
assert
np
.
abs
(
latents_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-
2
callback_fn
.
has_been_called
=
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