Unverified Commit 305f2b44 authored by Sayak Paul's avatar Sayak Paul Committed by GitHub
Browse files

[Tests] fix things after #7013 (#7899)

* debugging

* save the resulting image

* check if order reversing works.

* checking values.

* up

* okay

* checking

* fix

* remove print
parent cb0f3b49
...@@ -1294,7 +1294,7 @@ class LoraLoaderMixin: ...@@ -1294,7 +1294,7 @@ class LoraLoaderMixin:
text_encoder_module.lora_B[adapter_name].to(device) text_encoder_module.lora_B[adapter_name].to(device)
# this is a param, not a module, so device placement is not in-place -> re-assign # this is a param, not a module, so device placement is not in-place -> re-assign
if ( if (
hasattr(text_encoder, "lora_magnitude_vector") hasattr(text_encoder_module, "lora_magnitude_vector")
and text_encoder_module.lora_magnitude_vector is not None and text_encoder_module.lora_magnitude_vector is not None
): ):
text_encoder_module.lora_magnitude_vector[ text_encoder_module.lora_magnitude_vector[
......
...@@ -194,7 +194,7 @@ class LoraSDXLIntegrationTests(unittest.TestCase): ...@@ -194,7 +194,7 @@ class LoraSDXLIntegrationTests(unittest.TestCase):
).images ).images
images = images[0, -3:, -3:, -1].flatten() images = images[0, -3:, -3:, -1].flatten()
expected = np.array([0.4468, 0.4087, 0.4134, 0.366, 0.3202, 0.3505, 0.3786, 0.387, 0.3535]) expected = np.array([0.4468, 0.4061, 0.4134, 0.3637, 0.3202, 0.365, 0.3786, 0.3725, 0.3535])
max_diff = numpy_cosine_similarity_distance(expected, images) max_diff = numpy_cosine_similarity_distance(expected, images)
assert max_diff < 1e-4 assert max_diff < 1e-4
...@@ -283,7 +283,7 @@ class LoraSDXLIntegrationTests(unittest.TestCase): ...@@ -283,7 +283,7 @@ class LoraSDXLIntegrationTests(unittest.TestCase):
images = images[0, -3:, -3:, -1].flatten() images = images[0, -3:, -3:, -1].flatten()
# This way we also test equivalence between LoRA fusion and the non-fusion behaviour. # This way we also test equivalence between LoRA fusion and the non-fusion behaviour.
expected = np.array([0.4468, 0.4087, 0.4134, 0.366, 0.3202, 0.3505, 0.3786, 0.387, 0.3535]) expected = np.array([0.4468, 0.4061, 0.4134, 0.3637, 0.3202, 0.365, 0.3786, 0.3725, 0.3535])
max_diff = numpy_cosine_similarity_distance(expected, images) max_diff = numpy_cosine_similarity_distance(expected, images)
assert max_diff < 1e-4 assert max_diff < 1e-4
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment