Skip to content

Commit 582071f

Browse files
committed
[Tests] fix things after #7013 (#7899)
* debugging * save the resulting image * check if order reversing works. * checking values. * up * okay * checking * fix * remove print
1 parent e931bef commit 582071f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/diffusers/loaders/lora.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ def set_lora_device(self, adapter_names: List[str], device: Union[torch.device,
12941294
text_encoder_module.lora_B[adapter_name].to(device)
12951295
# this is a param, not a module, so device placement is not in-place -> re-assign
12961296
if (
1297-
hasattr(text_encoder, "lora_magnitude_vector")
1297+
hasattr(text_encoder_module, "lora_magnitude_vector")
12981298
and text_encoder_module.lora_magnitude_vector is not None
12991299
):
13001300
text_encoder_module.lora_magnitude_vector[

tests/lora/test_lora_layers_sdxl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def test_sdxl_1_0_lora(self):
194194
).images
195195

196196
images = images[0, -3:, -3:, -1].flatten()
197-
expected = np.array([0.4468, 0.4087, 0.4134, 0.366, 0.3202, 0.3505, 0.3786, 0.387, 0.3535])
197+
expected = np.array([0.4468, 0.4061, 0.4134, 0.3637, 0.3202, 0.365, 0.3786, 0.3725, 0.3535])
198198

199199
max_diff = numpy_cosine_similarity_distance(expected, images)
200200
assert max_diff < 1e-4
@@ -283,7 +283,7 @@ def test_sdxl_1_0_lora_fusion(self):
283283

284284
images = images[0, -3:, -3:, -1].flatten()
285285
# This way we also test equivalence between LoRA fusion and the non-fusion behaviour.
286-
expected = np.array([0.4468, 0.4087, 0.4134, 0.366, 0.3202, 0.3505, 0.3786, 0.387, 0.3535])
286+
expected = np.array([0.4468, 0.4061, 0.4134, 0.3637, 0.3202, 0.365, 0.3786, 0.3725, 0.3535])
287287

288288
max_diff = numpy_cosine_similarity_distance(expected, images)
289289
assert max_diff < 1e-4

0 commit comments

Comments
 (0)