UsernameJustAnother
commited on
Commit
•
8eb5e18
1
Parent(s):
3e834a5
Update README.md
Browse files
README.md
CHANGED
@@ -9,6 +9,10 @@ tags:
|
|
9 |
- unsloth
|
10 |
- mistral
|
11 |
- trl
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
# Uploaded model
|
@@ -17,6 +21,78 @@ 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 |
+
- gguf
|
14 |
+
- experimental
|
15 |
+
- long-context
|
16 |
---
|
17 |
|
18 |
# Uploaded model
|
|
|
21 |
- **License:** apache-2.0
|
22 |
- **Finetuned from model :** unsloth/Mistral-Nemo-Instruct-2407
|
23 |
|
24 |
+
I am a terrible liar. I came across another dataset I had to use, and this is the result. Still experimental, as 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
|
25 |
+
|
26 |
+
It is an RP finetune using 10,801 human-generated conversations of varying lengths from a variety of sources and some short stories, trained in ChatML format.
|
27 |
+
|
28 |
+
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.
|
29 |
+
|
30 |
+
Training took around 5 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.
|
31 |
+
|
32 |
+
It was trained with the following settings:
|
33 |
+
|
34 |
+
```
|
35 |
+
==((====))== Unsloth - 2x faster free finetuning | Num GPUs = 1
|
36 |
+
\\ /| Num examples = 10,801 | Num Epochs = 2
|
37 |
+
O^O/ \_/ \ Batch size per device = 2 | Gradient Accumulation steps = 4
|
38 |
+
\ / Total batch size = 8 | Total steps = 2,700
|
39 |
+
"-____-" Number of trainable parameters = 912,261,120
|
40 |
+
|
41 |
+
[ 14/2700 01:20 < 4:59:21, 0.15 it/s, Epoch 0.01/2]
|
42 |
+
[2040/2040 3:35:30, Epoch 2/2]
|
43 |
+
|
44 |
+
model = FastLanguageModel.get_peft_model(
|
45 |
+
model,
|
46 |
+
r = 256,
|
47 |
+
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
|
48 |
+
"gate_proj", "up_proj", "down_proj",],
|
49 |
+
lora_alpha = 32, # 32 / sqrt(256) gives a scaling factor of 2
|
50 |
+
lora_dropout = 0, # Supports any, but = 0 is optimized
|
51 |
+
bias = "none", # Supports any, but = "none" is optimized
|
52 |
+
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
|
53 |
+
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
|
54 |
+
random_state = 3407,
|
55 |
+
use_rslora = True, # setting the adapter scaling factor to lora_alpha/math.sqrt(r) instead of lora_alpha/r
|
56 |
+
loftq_config = None, # And LoftQ
|
57 |
+
)
|
58 |
+
|
59 |
+
lr_scheduler_kwargs = {
|
60 |
+
'min_lr': 0.0000024 # Adjust this value as needed
|
61 |
+
}
|
62 |
+
|
63 |
+
trainer = SFTTrainer(
|
64 |
+
model = model,
|
65 |
+
tokenizer = tokenizer,
|
66 |
+
train_dataset = train_ds,
|
67 |
+
compute_metrics = compute_metrics,
|
68 |
+
dataset_text_field = "text",
|
69 |
+
max_seq_length = max_seq_length,
|
70 |
+
dataset_num_proc = 2,
|
71 |
+
packing = False, # Can make training 5x faster for short sequences.
|
72 |
+
args = TrainingArguments(
|
73 |
+
per_device_train_batch_size = 2,
|
74 |
+
per_device_eval_batch_size = 2, # defaults to 8!
|
75 |
+
gradient_accumulation_steps = 4,
|
76 |
+
warmup_steps = 5,
|
77 |
+
num_train_epochs = 2,
|
78 |
+
learning_rate = 8e-5,
|
79 |
+
fp16 = not is_bfloat16_supported(),
|
80 |
+
bf16 = is_bfloat16_supported(),
|
81 |
+
fp16_full_eval = True, # stops eval from trying to use fp32
|
82 |
+
eval_strategy = "no", # 'no', 'steps', 'epoch'. Don't use this without an eval dataset etc
|
83 |
+
eval_steps = 1, # is eval_strat is set to 'steps', do every N steps.
|
84 |
+
logging_steps = 1, # so eval and logging happen on the same schedule
|
85 |
+
optim = "adamw_8bit",
|
86 |
+
weight_decay = 0.01,
|
87 |
+
lr_scheduler_type = "cosine_with_min_lr", # linear, cosine, cosine_with_min_lr, default linear
|
88 |
+
lr_scheduler_kwargs = lr_scheduler_kwargs, # needed for cosine_with_min_lr
|
89 |
+
seed = 3407,
|
90 |
+
output_dir = "outputs",
|
91 |
+
),
|
92 |
+
)
|
93 |
+
|
94 |
+
```
|
95 |
+
|
96 |
This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
97 |
|
98 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|