Upload folder using huggingface_hub
Browse files- README.md +108 -0
- config.json +26 -0
- model.safetensors +3 -0
- quantize_config.json +11 -0
- special_tokens_map.json +28 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +46 -0
README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
dtype: bfloat16
|
| 7 |
+
tags:
|
| 8 |
+
- merge
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# Results:
|
| 13 |
+
T: 🟦
|
| 14 |
+
Model: CultriX/MistralTrix-v1 📑
|
| 15 |
+
Average: 73.39
|
| 16 |
+
ARC: 72.27
|
| 17 |
+
HellaSwag: 88.33
|
| 18 |
+
MMLU: 65.24
|
| 19 |
+
TruthfulQA: 70.73
|
| 20 |
+
Winogrande: 80.98
|
| 21 |
+
GSM8K: 62.77
|
| 22 |
+
|
| 23 |
+
# Edit/Disclaimer:
|
| 24 |
+
Currently the #1 ranked 7B LLM on the LLM Leaderboards, woah!
|
| 25 |
+
I did not expect that result at all and am in no way a professional when it comes to LLM's or computer science in general,
|
| 26 |
+
just a guy that likes to nerd about and tinker around.
|
| 27 |
+
|
| 28 |
+
For those wondering how I achieved this, the answer is that I simply attempted to apply the techniques outlined in this amazing article myself: https://towardsdatascience.com/fine-tune-a-mistral-7b-model-with-direct-preference-optimization-708042745aac
|
| 29 |
+
Therefore, all credit basically goes to the guy who wrote that.
|
| 30 |
+
He offers the exact Colab notebook I used to train this model for free, as well as a really nice GitHub page I hope he doesn't mind me sharing: https://github.com/mlabonne/llm-course/
|
| 31 |
+
So huge thank you to him for sharing his knowledge and learning me a thing or two in the process!
|
| 32 |
+
|
| 33 |
+
# GGUF
|
| 34 |
+
I attempted to quantisize the model myself, which again I pretty much have no clue about, but it seems to run fine for me when I test them:
|
| 35 |
+
https://huggingface.co/CultriX/MistralTrix-v1-GGUF
|
| 36 |
+
|
| 37 |
+
I'll say it one more time though:
|
| 38 |
+
"I am a complete beginner to all of this, so if these do end up sucking don't be surprised."
|
| 39 |
+
|
| 40 |
+
You have been warned :)
|
| 41 |
+
|
| 42 |
+
# Description:
|
| 43 |
+
(trained on a single Colab GPU in less than a few hours)
|
| 44 |
+
|
| 45 |
+
MistralTrix-v1 is an zyh3826/GML-Mistral-merged-v1 model that has been further fine-tuned with Direct Preference Optimization (DPO) using Intel's dataset for neural-chat-7b-v3-1.
|
| 46 |
+
It surpasses the original model on several benchmarks (see results).
|
| 47 |
+
|
| 48 |
+
It is directly inspired by the RLHF process described by Intel/neural-chat-7b-v3-1's authors to improve performance.
|
| 49 |
+
I used the same dataset and reformatted it to apply the ChatML template.
|
| 50 |
+
|
| 51 |
+
The code to train this model is available on Google Colab and GitHub.
|
| 52 |
+
Fine-tuning took about an hour on Google Colab A-1000 GPU with 40GB VRAM.
|
| 53 |
+
|
| 54 |
+
# TRAINING SPECIFICATIONS
|
| 55 |
+
> LoRA configuration
|
| 56 |
+
peft_config = LoraConfig(
|
| 57 |
+
r=16,
|
| 58 |
+
lora_alpha=16,
|
| 59 |
+
lora_dropout=0.05,
|
| 60 |
+
bias="none",
|
| 61 |
+
task_type="CAUSAL_LM",
|
| 62 |
+
target_modules=['k_proj', 'gate_proj', 'v_proj', 'up_proj', 'q_proj', 'o_proj', 'down_proj']
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
> Model to fine-tune
|
| 66 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 67 |
+
model_name,
|
| 68 |
+
torch_dtype=torch.float16,
|
| 69 |
+
load_in_4bit=True
|
| 70 |
+
)
|
| 71 |
+
model.config.use_cache = False
|
| 72 |
+
|
| 73 |
+
> Reference model
|
| 74 |
+
ref_model = AutoModelForCausalLM.from_pretrained(
|
| 75 |
+
model_name,
|
| 76 |
+
torch_dtype=torch.float16,
|
| 77 |
+
load_in_4bit=True
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
> Training arguments
|
| 81 |
+
training_args = TrainingArguments(
|
| 82 |
+
per_device_train_batch_size=4,
|
| 83 |
+
gradient_accumulation_steps=4,
|
| 84 |
+
gradient_checkpointing=True,
|
| 85 |
+
learning_rate=5e-5,
|
| 86 |
+
lr_scheduler_type="cosine",
|
| 87 |
+
max_steps=200,
|
| 88 |
+
save_strategy="no",
|
| 89 |
+
logging_steps=1,
|
| 90 |
+
output_dir=new_model,
|
| 91 |
+
optim="paged_adamw_32bit",
|
| 92 |
+
warmup_steps=100,
|
| 93 |
+
bf16=True,
|
| 94 |
+
report_to="wandb",
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
> Create DPO trainer
|
| 98 |
+
dpo_trainer = DPOTrainer(
|
| 99 |
+
model,
|
| 100 |
+
ref_model,
|
| 101 |
+
args=training_args,
|
| 102 |
+
train_dataset=dataset,
|
| 103 |
+
tokenizer=tokenizer,
|
| 104 |
+
peft_config=peft_config,
|
| 105 |
+
beta=0.1,
|
| 106 |
+
max_prompt_length=1024,
|
| 107 |
+
max_length=1536,
|
| 108 |
+
)
|
config.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/opt/llm/_models/MistralTrix-v1",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"MistralForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"eos_token_id": 2,
|
| 9 |
+
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 4096,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 14336,
|
| 13 |
+
"max_position_embeddings": 32768,
|
| 14 |
+
"model_type": "mistral",
|
| 15 |
+
"num_attention_heads": 32,
|
| 16 |
+
"num_hidden_layers": 40,
|
| 17 |
+
"num_key_value_heads": 8,
|
| 18 |
+
"rms_norm_eps": 1e-05,
|
| 19 |
+
"rope_theta": 10000.0,
|
| 20 |
+
"sliding_window": 4096,
|
| 21 |
+
"tie_word_embeddings": false,
|
| 22 |
+
"torch_dtype": "float16",
|
| 23 |
+
"transformers_version": "4.36.2",
|
| 24 |
+
"use_cache": true,
|
| 25 |
+
"vocab_size": 32000
|
| 26 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85527d78352d4bef2bdb86c636ec53ee8db344be45f359e28ec94fc23bef4729
|
| 3 |
+
size 5067253800
|
quantize_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bits": 4,
|
| 3 |
+
"group_size": 128,
|
| 4 |
+
"damp_percent": 0.1,
|
| 5 |
+
"desc_act": true,
|
| 6 |
+
"static_groups": false,
|
| 7 |
+
"sym": true,
|
| 8 |
+
"true_sequential": true,
|
| 9 |
+
"model_name_or_path": null,
|
| 10 |
+
"model_file_base_name": null
|
| 11 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<unk>",
|
| 4 |
+
"<s>",
|
| 5 |
+
"</s>"
|
| 6 |
+
],
|
| 7 |
+
"bos_token": {
|
| 8 |
+
"content": "<s>",
|
| 9 |
+
"lstrip": false,
|
| 10 |
+
"normalized": false,
|
| 11 |
+
"rstrip": false,
|
| 12 |
+
"single_word": false
|
| 13 |
+
},
|
| 14 |
+
"eos_token": {
|
| 15 |
+
"content": "</s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false
|
| 20 |
+
},
|
| 21 |
+
"unk_token": {
|
| 22 |
+
"content": "<unk>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false
|
| 27 |
+
}
|
| 28 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
|
| 3 |
+
size 493443
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<unk>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<s>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"additional_special_tokens": [
|
| 29 |
+
"<unk>",
|
| 30 |
+
"<s>",
|
| 31 |
+
"</s>"
|
| 32 |
+
],
|
| 33 |
+
"bos_token": "<s>",
|
| 34 |
+
"clean_up_tokenization_spaces": false,
|
| 35 |
+
"eos_token": "</s>",
|
| 36 |
+
"legacy": true,
|
| 37 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 38 |
+
"pad_token": null,
|
| 39 |
+
"padding_side": "left",
|
| 40 |
+
"sp_model_kwargs": {},
|
| 41 |
+
"spaces_between_special_tokens": false,
|
| 42 |
+
"split_special_tokens": false,
|
| 43 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 44 |
+
"unk_token": "<unk>",
|
| 45 |
+
"use_default_system_prompt": true
|
| 46 |
+
}
|