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