Skip to content

Commit 8de4eb9

Browse files
committed
update
1 parent cb051b8 commit 8de4eb9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/lora/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,24 +260,26 @@ def _get_modules_to_save(self, pipe, has_denoiser=False):
260260

261261
return modules_to_save
262262

263-
def check_if_adapters_added_correctly(self, pipe, text_lora_config=None, denoiser_lora_config=None):
263+
def check_if_adapters_added_correctly(
264+
self, pipe, text_lora_config=None, denoiser_lora_config=None, adapter_name="default"
265+
):
264266
if text_lora_config is not None:
265267
if "text_encoder" in self.pipeline_class._lora_loadable_modules:
266-
pipe.text_encoder.add_adapter(text_lora_config)
268+
pipe.text_encoder.add_adapter(text_lora_config, adapter_name=adapter_name)
267269
self.assertTrue(
268270
check_if_lora_correctly_set(pipe.text_encoder), "Lora not correctly set in text encoder"
269271
)
270272

271273
if denoiser_lora_config is not None:
272274
denoiser = pipe.transformer if self.unet_kwargs is None else pipe.unet
273-
denoiser.add_adapter(denoiser_lora_config)
275+
denoiser.add_adapter(denoiser_lora_config, adapter_name=adapter_name)
274276
self.assertTrue(check_if_lora_correctly_set(denoiser), "Lora not correctly set in denoiser.")
275277
else:
276278
denoiser = None
277279

278280
if text_lora_config is not None and self.has_two_text_encoders or self.has_three_text_encoders:
279281
if "text_encoder_2" in self.pipeline_class._lora_loadable_modules:
280-
pipe.text_encoder_2.add_adapter(text_lora_config)
282+
pipe.text_encoder_2.add_adapter(text_lora_config, adapter_name=adapter_name)
281283
self.assertTrue(
282284
check_if_lora_correctly_set(pipe.text_encoder_2), "Lora not correctly set in text encoder 2"
283285
)

0 commit comments

Comments
 (0)