Skip to content

Commit

Permalink
fix xcomposer lora (modelscope#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang committed Jul 31, 2024
1 parent 92e1179 commit 655583a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions swift/llm/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def prepare_model(model, args: SftArguments):
'init_lora_weights': args.init_lora_weights,
}
if args.sft_type in ('lora', 'longlora'):
# Fix the name of the layer in xcomposer that contains Plora.
if any(['lora_' in n for n, p in model.named_parameters()]):
model.requires_grad_(False)
if args.lora_dtype == 'AUTO':
args.lora_dtype = None
if args.tuner_backend == 'swift':
Expand Down

0 comments on commit 655583a

Please sign in to comment.