Skip to content

Commit 25eb0a0

Browse files
authored
Fix peft patch (#1650)
1 parent e040202 commit 25eb0a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

swift/tuners/peft.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ def hot_patch_peft_module():
312312

313313
# Support type conversion
314314
def init(self, model: torch.nn.Module, config: Dict[str, LoraConfig], adapter_name):
315-
if config.get('default') and isinstance(config['default'].target_modules, str):
315+
if isinstance(config, dict) and config.get('default') and isinstance(
316+
getattr(config['default'], 'target_modules', None), str):
316317
# Make sure the regex can find all linear in the module.
317318
LoraModel._create_and_replace = _create_and_replace_hook2
318319

0 commit comments

Comments
 (0)