Skip to content

Commit cbea8ae

Browse files
tastelikefeettastelikefeet
andauthored
Update unsloth compatibility (#3970)
Co-authored-by: tastelikefeet <[email protected]>
1 parent 0e8f4f0 commit cbea8ae

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

swift/cli/sft.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Copyright (c) Alibaba, Inc. and its affiliates.
22
import os
33

4-
if int(os.environ.get('UNSLOTH_PATCH_TRL', '0')) != 0:
5-
import unsloth
6-
74
from swift.llm import sft_main
85

96
if __name__ == '__main__':

swift/llm/model/register.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ def load_by_unsloth(args):
142142
model_name=args.adapters and args.adapters[0] or args.model_dir,
143143
dtype=args.torch_dtype,
144144
max_seq_length=args.max_length,
145+
full_finetuning=args.quant_bits is None,
145146
load_in_4bit=args.quant_bits == 4,
147+
load_in_8bit=args.quant_bits == 8,
146148
)
147149
if isinstance(model, PeftModel):
148150
base_model = model.model

0 commit comments

Comments
 (0)