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
30bcda7d
"...python/git@developer.sourcefind.cn:change/sglang.git" did not exist on "f792e3c561b427b9b00648cc4f23f54f457f46cc"
Unverified
Commit
30bcda7d
authored
Feb 13, 2024
by
Dhruv Nair
Committed by
GitHub
Feb 13, 2024
Browse files
Fix flaky IP Adapter test (#6960)
update
parent
9ea62d11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
tests/pipelines/ip_adapters/test_ip_adapter_stable_diffusion.py
...pipelines/ip_adapters/test_ip_adapter_stable_diffusion.py
+3
-1
No files found.
tests/pipelines/ip_adapters/test_ip_adapter_stable_diffusion.py
View file @
30bcda7d
...
@@ -35,6 +35,7 @@ from diffusers.models.attention_processor import AttnProcessor, AttnProcessor2_0
...
@@ -35,6 +35,7 @@ from diffusers.models.attention_processor import AttnProcessor, AttnProcessor2_0
from
diffusers.utils
import
load_image
from
diffusers.utils
import
load_image
from
diffusers.utils.testing_utils
import
(
from
diffusers.utils.testing_utils
import
(
enable_full_determinism
,
enable_full_determinism
,
is_flaky
,
numpy_cosine_similarity_distance
,
numpy_cosine_similarity_distance
,
require_torch_gpu
,
require_torch_gpu
,
slow
,
slow
,
...
@@ -259,6 +260,7 @@ class IPAdapterSDIntegrationTests(IPAdapterNightlyTestsMixin):
...
@@ -259,6 +260,7 @@ class IPAdapterSDIntegrationTests(IPAdapterNightlyTestsMixin):
]
]
assert
processors
==
[
True
]
*
len
(
processors
)
assert
processors
==
[
True
]
*
len
(
processors
)
@
is_flaky
def
test_multi
(
self
):
def
test_multi
(
self
):
image_encoder
=
self
.
get_image_encoder
(
repo_id
=
"h94/IP-Adapter"
,
subfolder
=
"models/image_encoder"
)
image_encoder
=
self
.
get_image_encoder
(
repo_id
=
"h94/IP-Adapter"
,
subfolder
=
"models/image_encoder"
)
pipeline
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline
=
StableDiffusionPipeline
.
from_pretrained
(
...
@@ -275,7 +277,7 @@ class IPAdapterSDIntegrationTests(IPAdapterNightlyTestsMixin):
...
@@ -275,7 +277,7 @@ class IPAdapterSDIntegrationTests(IPAdapterNightlyTestsMixin):
inputs
[
"ip_adapter_image"
]
=
[
ip_adapter_image
,
[
ip_adapter_image
]
*
2
]
inputs
[
"ip_adapter_image"
]
=
[
ip_adapter_image
,
[
ip_adapter_image
]
*
2
]
images
=
pipeline
(
**
inputs
).
images
images
=
pipeline
(
**
inputs
).
images
image_slice
=
images
[
0
,
:
3
,
:
3
,
-
1
].
flatten
()
image_slice
=
images
[
0
,
:
3
,
:
3
,
-
1
].
flatten
()
expected_slice
=
np
.
array
([
0.
170
4
,
0.
1296
,
0.1272
,
0.2212
,
0.1514
,
0.1479
,
0.4172
,
0.4263
,
0.4360
])
expected_slice
=
np
.
array
([
0.
523
4
,
0.
5352
,
0.5625
,
0.5713
,
0.5947
,
0.6206
,
0.5786
,
0.6187
,
0.6494
])
max_diff
=
numpy_cosine_similarity_distance
(
image_slice
,
expected_slice
)
max_diff
=
numpy_cosine_similarity_distance
(
image_slice
,
expected_slice
)
assert
max_diff
<
5e-4
assert
max_diff
<
5e-4
...
...
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