UsernameJustAnother commited on
Commit
698ec11
1 Parent(s): d53d9da

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -0
README.md CHANGED
@@ -9,6 +9,9 @@ tags:
9
  - unsloth
10
  - mistral
11
  - trl
 
 
 
12
  ---
13
 
14
  # Uploaded model
@@ -17,6 +20,77 @@ tags:
17
  - **License:** apache-2.0
18
  - **Finetuned from model :** unsloth/Mistral-Nemo-Instruct-2407
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
  [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
9
  - unsloth
10
  - mistral
11
  - trl
12
+ - rp
13
+ - experimental
14
+ - long-context
15
  ---
16
 
17
  # Uploaded model
 
20
  - **License:** apache-2.0
21
  - **Finetuned from model :** unsloth/Mistral-Nemo-Instruct-2407
22
 
23
+ This is the 4th (and likely final) experimental fine-tune of Nemo. I made these to teach myself the basics of fine-tuning, with notes extensively borrowed from https://huggingface.co/nothingiisreal/MN-12B-Celeste-V1.9
24
+
25
+ It is an RP finetune using 8,160 human-generated conversations of varying lengths from a variety of sources, trained in ChatML format.
26
+
27
+ The big differences from Celeste is a different LoRA scaling factor. Celeste uses 8; I did several tests with this data before concluding I got lower training loss with 2.
28
+
29
+ Training took around 4 hours on a single Colab A100 (but I didn't do an eval loop). Neat that I could get it all to fit into 40GB of vRAM thanks to Unsloth.
30
+
31
+ It was trained with the following settings:
32
+
33
+ ```
34
+ ==((====))== Unsloth - 2x faster free finetuning | Num GPUs = 1
35
+ \\ /| Num examples = 8,160 | Num Epochs = 2
36
+ O^O/ \_/ \ Batch size per device = 2 | Gradient Accumulation steps = 4
37
+ \ / Total batch size = 8 | Total steps = 2,040
38
+ "-____-" Number of trainable parameters = 912,261,120
39
+
40
+ [2040/2040 3:35:30, Epoch 2/2]
41
+
42
+ model = FastLanguageModel.get_peft_model(
43
+ model,
44
+ r = 256,
45
+ target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
46
+ "gate_proj", "up_proj", "down_proj",],
47
+ lora_alpha = 32, # 32 / sqrt(256) gives a scaling factor of 2
48
+ lora_dropout = 0, # Supports any, but = 0 is optimized
49
+ bias = "none", # Supports any, but = "none" is optimized
50
+ # [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
51
+ use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
52
+ random_state = 3407,
53
+ use_rslora = True, # setting the adapter scaling factor to lora_alpha/math.sqrt(r) instead of lora_alpha/r
54
+ loftq_config = None, # And LoftQ
55
+ )
56
+
57
+ lr_scheduler_kwargs = {
58
+ 'min_lr': 0.0000024 # Adjust this value as needed
59
+ }
60
+
61
+ trainer = SFTTrainer(
62
+ model = model,
63
+ tokenizer = tokenizer,
64
+ train_dataset = train_ds,
65
+ compute_metrics = compute_metrics,
66
+ dataset_text_field = "text",
67
+ max_seq_length = max_seq_length,
68
+ dataset_num_proc = 2,
69
+ packing = False, # Can make training 5x faster for short sequences.
70
+ args = TrainingArguments(
71
+ per_device_train_batch_size = 2,
72
+ per_device_eval_batch_size = 2, # defaults to 8!
73
+ gradient_accumulation_steps = 4,
74
+ warmup_steps = 5,
75
+ num_train_epochs = 2,
76
+ learning_rate = 8e-5,
77
+ fp16 = not is_bfloat16_supported(),
78
+ bf16 = is_bfloat16_supported(),
79
+ fp16_full_eval = True, # stops eval from trying to use fp32
80
+ eval_strategy = "no", # 'no', 'steps', 'epoch'. Don't use this without an eval dataset etc
81
+ eval_steps = 1, # is eval_strat is set to 'steps', do every N steps.
82
+ logging_steps = 1, # so eval and logging happen on the same schedule
83
+ optim = "adamw_8bit",
84
+ weight_decay = 0.01,
85
+ lr_scheduler_type = "cosine_with_min_lr", # linear, cosine, cosine_with_min_lr, default linear
86
+ lr_scheduler_kwargs = lr_scheduler_kwargs, # needed for cosine_with_min_lr
87
+ seed = 3407,
88
+ output_dir = "outputs",
89
+ ),
90
+ )
91
+
92
+ ```
93
+
94
  This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
95
 
96
  [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)