From cff1e39f1bd51946bb1981d99868828c72905bc4 Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Wed, 6 May 2026 08:23:14 +0900 Subject: [PATCH] [tests] fix lora tests involving clip. (#13675) fix lora tests involving clip. --- tests/lora/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/lora/utils.py b/tests/lora/utils.py index efa49b9f48..547dbc8a5f 100644 --- a/tests/lora/utils.py +++ b/tests/lora/utils.py @@ -635,7 +635,7 @@ class PeftLoraLoaderMixinTests: state_dict = { f"text_encoder.{module_name}": param for module_name, param in get_peft_model_state_dict(pipe.text_encoder).items() - if "text_model.encoder.layers.4" not in module_name + if "encoder.layers.4" not in module_name } if self.has_two_text_encoders or self.has_three_text_encoders: @@ -644,7 +644,7 @@ class PeftLoraLoaderMixinTests: { f"text_encoder_2.{module_name}": param for module_name, param in get_peft_model_state_dict(pipe.text_encoder_2).items() - if "text_model.encoder.layers.4" not in module_name + if "encoder.layers.4" not in module_name } ) @@ -776,8 +776,9 @@ class PeftLoraLoaderMixinTests: ) if "text_encoder" in self.pipeline_class._lora_loadable_modules: + text_encoder_root = getattr(pipe.text_encoder, "text_model", pipe.text_encoder) self.assertTrue( - pipe.text_encoder.text_model.encoder.layers[0].self_attn.q_proj.scaling["default"] == 1.0, + text_encoder_root.encoder.layers[0].self_attn.q_proj.scaling["default"] == 1.0, "The scaling parameter has not been correctly restored!", )