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
bf6eaa8a
Unverified
Commit
bf6eaa8a
authored
Dec 20, 2024
by
Sayak Paul
Committed by
GitHub
Dec 20, 2024
Browse files
[Tests] add integration tests for lora expansion stuff in Flux. (#10318)
add integration tests for lora expansion stuff in Flux.
parent
17128c42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
tests/lora/test_lora_layers_flux.py
tests/lora/test_lora_layers_flux.py
+37
-0
No files found.
tests/lora/test_lora_layers_flux.py
View file @
bf6eaa8a
...
@@ -825,3 +825,40 @@ class FluxControlLoRAIntegrationTests(unittest.TestCase):
...
@@ -825,3 +825,40 @@ class FluxControlLoRAIntegrationTests(unittest.TestCase):
max_diff
=
numpy_cosine_similarity_distance
(
expected_slice
.
flatten
(),
out_slice
)
max_diff
=
numpy_cosine_similarity_distance
(
expected_slice
.
flatten
(),
out_slice
)
assert
max_diff
<
1e-3
assert
max_diff
<
1e-3
@
parameterized
.
expand
([
"black-forest-labs/FLUX.1-Canny-dev-lora"
,
"black-forest-labs/FLUX.1-Depth-dev-lora"
])
def
test_lora_with_turbo
(
self
,
lora_ckpt_id
):
self
.
pipeline
.
load_lora_weights
(
lora_ckpt_id
)
self
.
pipeline
.
load_lora_weights
(
"ByteDance/Hyper-SD"
,
weight_name
=
"Hyper-FLUX.1-dev-8steps-lora.safetensors"
)
self
.
pipeline
.
fuse_lora
()
self
.
pipeline
.
unload_lora_weights
()
if
"Canny"
in
lora_ckpt_id
:
control_image
=
load_image
(
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/flux-control-lora/canny_condition_image.png"
)
else
:
control_image
=
load_image
(
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/flux-control-lora/depth_condition_image.png"
)
image
=
self
.
pipeline
(
prompt
=
self
.
prompt
,
control_image
=
control_image
,
height
=
1024
,
width
=
1024
,
num_inference_steps
=
self
.
num_inference_steps
,
guidance_scale
=
30.0
if
"Canny"
in
lora_ckpt_id
else
10.0
,
output_type
=
"np"
,
generator
=
torch
.
manual_seed
(
self
.
seed
),
).
images
out_slice
=
image
[
0
,
-
3
:,
-
3
:,
-
1
].
flatten
()
if
"Canny"
in
lora_ckpt_id
:
expected_slice
=
np
.
array
([
0.6562
,
0.7266
,
0.7578
,
0.6367
,
0.6758
,
0.7031
,
0.6172
,
0.6602
,
0.6484
])
else
:
expected_slice
=
np
.
array
([
0.6680
,
0.7344
,
0.7656
,
0.6484
,
0.6875
,
0.7109
,
0.6328
,
0.6719
,
0.6562
])
max_diff
=
numpy_cosine_similarity_distance
(
expected_slice
.
flatten
(),
out_slice
)
assert
max_diff
<
1e-3
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