Mr-FineTuner commited on
Commit
ec9f368
·
verified ·
1 Parent(s): 21d3a98

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -3
README.md CHANGED
@@ -6,9 +6,71 @@ tags:
6
 
7
  # Model Card for Model ID
8
 
9
- <!-- Provide a quick summary of what the model is/does. -->
10
-
11
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  ## Model Details
14
 
 
6
 
7
  # Model Card for Model ID
8
 
9
+ model = FastLanguageModel.get_peft_model(
10
+ model,
11
+ r = 32, # Choose any number > 0 ! Suggested 8, 16, 32, 64, 128
12
+ target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
13
+ "gate_proj", "up_proj", "down_proj",],
14
+ lora_alpha = 32,
15
+ lora_dropout = 0.1, # Supports any, but = 0 is optimized
16
+ bias = "none", # Supports any, but = "none" is optimized
17
+ # [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
18
+ use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
19
+ random_state = 3407,
20
+ use_rslora = False, # We support rank stabilized LoRA
21
+ loftq_config = None, # And LoftQ
22
+ )
23
+
24
+ chat_template = """
25
+ ### Input:
26
+ Generate a sentence that includes a word at the CEFR level {INPUT}. The sentence should be meaningful, contextually appropriate, and clearly demonstrate the usage of the word at the specified CEFR level. Ensure that the sentence is suitable for learners at this level, providing clear context for the word meaning.
27
+ Make the output format to be like this
28
+ The word is: sleep and it is a verb. Example sentence: I sleep early.
29
+ The word is: reciprocate and it is a verb. Example sentence: He reciprocated her kindness warmly.
30
+
31
+ ### Response:
32
+ {OUTPUT}
33
+
34
+ ### Input:
35
+ Generate a sentence that includes a word at the CEFR level {INPUT}. The sentence should be meaningful, contextually appropriate, and clearly demonstrate the usage of the word at the specified CEFR level. Ensure that the sentence is suitable for learners at this level, providing clear context for the word meaning.
36
+ Make the output format to be like this
37
+ The word is: sleep and it is a verb. Example sentence: I sleep early.
38
+ The word is: reciprocate and it is a verb. Example sentence: He reciprocated her kindness warmly.
39
+
40
+ ### Response:
41
+ {OUTPUT}
42
+
43
+ """
44
+
45
+ from trl import SFTTrainer
46
+ from transformers import TrainingArguments
47
+ from unsloth import is_bfloat16_supported
48
+
49
+ trainer = SFTTrainer(
50
+ model = model,
51
+ tokenizer = tokenizer,
52
+ train_dataset = dataset,
53
+ dataset_text_field = "text",
54
+ max_seq_length = max_seq_length,
55
+ dataset_num_proc = 2,
56
+ packing = False, # Can make training 5x faster for short sequences.
57
+ args = TrainingArguments(
58
+ per_device_train_batch_size = 1,
59
+ gradient_accumulation_steps = 4,
60
+ warmup_steps = 5,
61
+ # max_steps = 120,
62
+ num_train_epochs = 1, # Set this instead of max_steps for full training runs
63
+ learning_rate = 2e-4,
64
+ fp16 = not is_bfloat16_supported(),
65
+ bf16 = is_bfloat16_supported(),
66
+ logging_steps = 1,
67
+ optim = "adamw_8bit",
68
+ weight_decay = 0.01,
69
+ lr_scheduler_type = "linear",
70
+ seed = 3407,
71
+ output_dir = "outputs",
72
+ ),
73
+ )
74
 
75
  ## Model Details
76