Skip to content

Commit 655583a

Browse files
authored
fix xcomposer lora (#1559)
1 parent 92e1179 commit 655583a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

swift/llm/tuner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ def prepare_model(model, args: SftArguments):
119119
'init_lora_weights': args.init_lora_weights,
120120
}
121121
if args.sft_type in ('lora', 'longlora'):
122+
# Fix the name of the layer in xcomposer that contains Plora.
123+
if any(['lora_' in n for n, p in model.named_parameters()]):
124+
model.requires_grad_(False)
122125
if args.lora_dtype == 'AUTO':
123126
args.lora_dtype = None
124127
if args.tuner_backend == 'swift':

0 commit comments

Comments
 (0)