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
08ac5cbc
Unverified
Commit
08ac5cbc
authored
Nov 06, 2024
by
SahilCarterr
Committed by
GitHub
Nov 05, 2024
Browse files
[Fix] Test of sd3 lora (#9843)
* fix test * fix test asser * fix format * Update test_lora_layers_sd3.py
parent
3f329a42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
37 deletions
+3
-37
tests/lora/test_lora_layers_sd3.py
tests/lora/test_lora_layers_sd3.py
+3
-37
No files found.
tests/lora/test_lora_layers_sd3.py
View file @
08ac5cbc
...
@@ -166,48 +166,14 @@ class LoraSD3IntegrationTests(unittest.TestCase):
...
@@ -166,48 +166,14 @@ class LoraSD3IntegrationTests(unittest.TestCase):
def
test_sd3_img2img_lora
(
self
):
def
test_sd3_img2img_lora
(
self
):
pipe
=
self
.
pipeline_class
.
from_pretrained
(
self
.
repo_id
,
torch_dtype
=
torch
.
float16
)
pipe
=
self
.
pipeline_class
.
from_pretrained
(
self
.
repo_id
,
torch_dtype
=
torch
.
float16
)
pipe
.
load_lora_weights
(
"
nerijs/pixel-art-xl"
,
weight_name
=
"pixel-art-xl
.safetensors"
)
pipe
.
load_lora_weights
(
"
zwloong/sd3-lora-training-rank16-v2"
,
weight_name
=
"pytorch_lora_weights
.safetensors"
)
pipe
.
enable_sequential_cpu_offload
()
pipe
.
enable_sequential_cpu_offload
()
inputs
=
self
.
get_inputs
(
torch_device
)
inputs
=
self
.
get_inputs
(
torch_device
)
image
=
pipe
(
**
inputs
).
images
[
0
]
image
=
pipe
(
**
inputs
).
images
[
0
]
image_slice
=
image
[
0
,
:
10
,
:
10
]
image_slice
=
image
[
0
,
-
3
:,
-
3
:]
expected_slice
=
np
.
array
(
expected_slice
=
np
.
array
([
0.5396
,
0.5776
,
0.7432
,
0.5151
,
0.5586
,
0.7383
,
0.5537
,
0.5933
,
0.7153
])
[
0.47827148
,
0.5
,
0.71972656
,
0.3955078
,
0.4194336
,
0.69628906
,
0.37036133
,
0.40820312
,
0.6923828
,
0.36450195
,
0.40429688
,
0.6904297
,
0.35595703
,
0.39257812
,
0.68652344
,
0.35498047
,
0.3984375
,
0.68310547
,
0.34716797
,
0.3996582
,
0.6855469
,
0.3388672
,
0.3959961
,
0.6816406
,
0.34033203
,
0.40429688
,
0.6845703
,
0.34228516
,
0.4086914
,
0.6870117
,
]
)
max_diff
=
numpy_cosine_similarity_distance
(
expected_slice
.
flatten
(),
image_slice
.
flatten
())
max_diff
=
numpy_cosine_similarity_distance
(
expected_slice
.
flatten
(),
image_slice
.
flatten
())
assert
max_diff
<
1e-4
,
f
"Outputs are not close enough, got
{
max_diff
}
"
assert
max_diff
<
1e-4
,
f
"Outputs are not close enough, got
{
max_diff
}
"
...
...
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