@@ -2246,7 +2246,7 @@ def test_no_warning_without_naming_conflict_get_peft_model(self, recwarn):
22462246 # No warning should be raised when there is no naming conflict during get_peft_model.
22472247 non_conflict_adapter = "adapter"
22482248 _ = get_peft_model (self .base_model , self .peft_config , adapter_name = non_conflict_adapter )
2249- expected_msg = f"Adapter name { non_conflict_adapter } should not be contained in the prefix { self .prefix } ."
2249+ expected_msg = f"Adapter name ' { non_conflict_adapter } ' should not be contained in the prefix ' { self .prefix } ' ."
22502250 assert not any (expected_msg in str (w .message ) for w in recwarn .list )
22512251
22522252 def test_no_warning_without_naming_conflict_add_adapter (self , recwarn ):
@@ -2256,7 +2256,7 @@ def test_no_warning_without_naming_conflict_add_adapter(self, recwarn):
22562256 model = get_peft_model (self .base_model , self .peft_config , adapter_name = non_conflict_adapter )
22572257 _ = model .add_adapter (other_non_conflict_adapter , self .peft_config )
22582258 expected_msg = (
2259- f"Adapter name { other_non_conflict_adapter } should not be contained in the prefix { self .prefix } ."
2259+ f"Adapter name ' { other_non_conflict_adapter } ' should not be contained in the prefix ' { self .prefix } ' ."
22602260 )
22612261 assert not any (expected_msg in str (w .message ) for w in recwarn .list )
22622262
@@ -2265,14 +2265,16 @@ def test_no_warning_without_naming_conflict_save_and_load(self, recwarn, tmp_pat
22652265 non_conflict_adapter = "adapter"
22662266 model = get_peft_model (self .base_model , self .peft_config , adapter_name = non_conflict_adapter )
22672267 _ = self ._save_and_reload_model (model , non_conflict_adapter , tmp_path )
2268- expected_msg = f"Adapter name { non_conflict_adapter } should not be contained in the prefix { self .prefix } ."
2268+ expected_msg = f"Adapter name ' { non_conflict_adapter } ' should not be contained in the prefix ' { self .prefix } ' ."
22692269 assert not any (expected_msg in str (w .message ) for w in recwarn .list )
22702270
22712271 def test_warning_naming_conflict_get_peft_model (self , recwarn ):
22722272 # Warning is raised when the adapter name conflicts with the prefix in get_peft_model.
22732273 conflicting_adapter_name = self .prefix [:- 1 ]
22742274 _ = get_peft_model (self .base_model , self .peft_config , adapter_name = conflicting_adapter_name )
2275- expected_msg = f"Adapter name { conflicting_adapter_name } should not be contained in the prefix { self .prefix } ."
2275+ expected_msg = (
2276+ f"Adapter name '{ conflicting_adapter_name } ' should not be contained in the prefix '{ self .prefix } '."
2277+ )
22762278 assert any (expected_msg in str (w .message ) for w in recwarn .list )
22772279
22782280 def test_warning_naming_conflict_add_adapter (self , recwarn ):
@@ -2281,15 +2283,15 @@ def test_warning_naming_conflict_add_adapter(self, recwarn):
22812283 non_conflict_adapter = "adapter"
22822284 model = get_peft_model (self .base_model , self .peft_config , adapter_name = non_conflict_adapter )
22832285 _ = model .add_adapter (conflicting_adapter , self .peft_config )
2284- expected_msg = f"Adapter name { conflicting_adapter } should not be contained in the prefix { self .prefix } ."
2286+ expected_msg = f"Adapter name ' { conflicting_adapter } ' should not be contained in the prefix ' { self .prefix } ' ."
22852287 assert any (expected_msg in str (w .message ) for w in recwarn .list )
22862288
22872289 def test_warning_naming_conflict_save_and_load (self , recwarn , tmp_path ):
22882290 # Warning is raised when saving and loading the model with a naming conflict.
22892291 conflicting_adapter = self .prefix [:- 1 ]
22902292 model = get_peft_model (self .base_model , self .peft_config , adapter_name = conflicting_adapter )
22912293 _ = self ._save_and_reload_model (model , conflicting_adapter , tmp_path )
2292- expected_msg = f"Adapter name { conflicting_adapter } should not be contained in the prefix { self .prefix } ."
2294+ expected_msg = f"Adapter name ' { conflicting_adapter } ' should not be contained in the prefix ' { self .prefix } ' ."
22932295 assert any (expected_msg in str (w .message ) for w in recwarn .list )
22942296
22952297
0 commit comments