Skip to content

Commit cff1e39

Browse files
authored
[tests] fix lora tests involving clip. (#13675)
fix lora tests involving clip.
1 parent 2b9572d commit cff1e39

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/lora/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ def test_simple_inference_with_partial_text_lora(self):
635635
state_dict = {
636636
f"text_encoder.{module_name}": param
637637
for module_name, param in get_peft_model_state_dict(pipe.text_encoder).items()
638-
if "text_model.encoder.layers.4" not in module_name
638+
if "encoder.layers.4" not in module_name
639639
}
640640

641641
if self.has_two_text_encoders or self.has_three_text_encoders:
@@ -644,7 +644,7 @@ def test_simple_inference_with_partial_text_lora(self):
644644
{
645645
f"text_encoder_2.{module_name}": param
646646
for module_name, param in get_peft_model_state_dict(pipe.text_encoder_2).items()
647-
if "text_model.encoder.layers.4" not in module_name
647+
if "encoder.layers.4" not in module_name
648648
}
649649
)
650650

@@ -776,8 +776,9 @@ def test_simple_inference_with_text_denoiser_lora_and_scale(self):
776776
)
777777

778778
if "text_encoder" in self.pipeline_class._lora_loadable_modules:
779+
text_encoder_root = getattr(pipe.text_encoder, "text_model", pipe.text_encoder)
779780
self.assertTrue(
780-
pipe.text_encoder.text_model.encoder.layers[0].self_attn.q_proj.scaling["default"] == 1.0,
781+
text_encoder_root.encoder.layers[0].self_attn.q_proj.scaling["default"] == 1.0,
781782
"The scaling parameter has not been correctly restored!",
782783
)
783784

0 commit comments

Comments
 (0)