@@ -583,44 +583,6 @@ def test_pissa_alpha_pattern_and_rslora_raises(self, tmp_path):
583
583
tmp_path / "pissa-model" , path_initial_model_for_weight_conversion = tmp_path / "init-model"
584
584
)
585
585
586
- # TODO: remove test for deprecated arg in PEFT v0.14.0
587
- def test_lora_pissa_conversion_same_output_after_loading_with_deprecated_arg (self , data , tmp_path ):
588
- model = self .get_model ()
589
- config = LoraConfig (init_lora_weights = "pissa" , target_modules = ["linear" ], r = 8 )
590
- peft_model = get_peft_model (deepcopy (model ), config )
591
- peft_model .peft_config ["default" ].init_lora_weights = True
592
- peft_model .save_pretrained (tmp_path / "init-model" )
593
- peft_model .peft_config ["default" ].init_lora_weights = "pissa"
594
-
595
- tol = 1e-06
596
- peft_model .base_model .linear .lora_B ["default" ].weight .data *= 2.0
597
- output_pissa = peft_model (data )[0 ]
598
-
599
- peft_model .save_pretrained (tmp_path / "pissa-model-converted" , convert_pissa_to_lora = tmp_path / "init-model" )
600
- model_converted = PeftModel .from_pretrained (deepcopy (model ), tmp_path / "pissa-model-converted" )
601
- output_converted = model_converted (data )[0 ]
602
-
603
- assert torch .allclose (output_pissa , output_converted , atol = tol , rtol = tol )
604
- assert model_converted .peft_config ["default" ].r == 16
605
- assert model_converted .base_model .model .linear .lora_A ["default" ].weight .shape [0 ] == 16
606
- assert torch .allclose (
607
- model .linear .weight , model_converted .base_model .model .linear .base_layer .weight , atol = tol , rtol = tol
608
- )
609
-
610
- # TODO: remove test for deprecated warning in PEFT v0.14.0
611
- def test_lora_pissa_conversion_deprecated_warning (self , data , tmp_path ):
612
- model = self .get_model ()
613
- config = LoraConfig (init_lora_weights = "pissa" , target_modules = ["linear" ], r = 8 )
614
- peft_model = get_peft_model (deepcopy (model ), config )
615
- peft_model .peft_config ["default" ].init_lora_weights = True
616
- peft_model .save_pretrained (tmp_path / "init-model" )
617
- warning_message = "`convert_pissa_to_lora` is deprecated and will be removed in a future version. Use `path_initial_model_for_weight_conversion` instead."
618
- # Test the warning
619
- with pytest .warns (UserWarning , match = warning_message ):
620
- peft_model .save_pretrained (
621
- tmp_path / "pissa-model-converted" , convert_pissa_to_lora = tmp_path / "init-model"
622
- )
623
-
624
586
def test_olora_conversion_same_output_after_loading (self , data , tmp_path ):
625
587
model = self .get_model ()
626
588
output_base = model (data )[0 ]
0 commit comments