Upload fine-tuned Mistral-7B CEFR model with exact and within-1 confusion matrices
Browse files- .ipynb_checkpoints/TEST_TRAIN_UNIFIEDDATASET_mistral_1epoch-checkpoint.ipynb +0 -0
- README.md +64 -0
- TEST_TRAIN_UNIFIEDDATASET_mistral_1epoch.ipynb +0 -0
- adapter_config.json +37 -0
- adapter_model.safetensors +3 -0
- config.json +41 -0
- confusion_matrix_exact.csv +7 -0
- confusion_matrix_exact.png +0 -0
- confusion_matrix_within1.csv +7 -0
- confusion_matrix_within1.png +0 -0
- generation_config.json +8 -0
- model.safetensors +3 -0
- model.safetensors.index.json +0 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +45 -0
.ipynb_checkpoints/TEST_TRAIN_UNIFIEDDATASET_mistral_1epoch-checkpoint.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# Fine-Tuned Gemma-7B CEFR Model
|
| 3 |
+
|
| 4 |
+
This is a fine-tuned version of `unsloth/gemma-7b-bnb-4bit` for CEFR-level sentence generation, evaluated with a fine-tuned classifier from `Mr-FineTuner/Skripsi_validator_best_model`.
|
| 5 |
+
|
| 6 |
+
- **Base Model**: unsloth/gemma-7b-bnb-4bit
|
| 7 |
+
- **Fine-Tuning**: LoRA with balanced dataset
|
| 8 |
+
- **Training Details**:
|
| 9 |
+
- Dataset: CEFR-level sentences (balanced)
|
| 10 |
+
- LoRA Parameters: r=32, lora_alpha=32, lora_dropout=0.5
|
| 11 |
+
- Training Args: learning_rate=2e-5, batch_size=8, epochs=0.01, cosine scheduler
|
| 12 |
+
- Optimizer: adamw_8bit
|
| 13 |
+
- Early Stopping: Patience=3, threshold=0.01
|
| 14 |
+
- **Evaluation Metrics (Exact Matches)**:
|
| 15 |
+
- CEFR Classifier Accuracy: 0.167
|
| 16 |
+
- Precision (Macro): 0.033
|
| 17 |
+
- Recall (Macro): 0.167
|
| 18 |
+
- F1-Score (Macro): 0.056
|
| 19 |
+
- **Evaluation Metrics (Within ±1 Level)**:
|
| 20 |
+
- CEFR Classifier Accuracy: 0.667
|
| 21 |
+
- Precision (Macro): 0.556
|
| 22 |
+
- Recall (Macro): 0.667
|
| 23 |
+
- F1-Score (Macro): 0.583
|
| 24 |
+
- **Other Metrics**:
|
| 25 |
+
- Perplexity: 2.952
|
| 26 |
+
- Diversity (Unique Sentences): 0.100
|
| 27 |
+
- Inference Time (ms): 6696.712
|
| 28 |
+
- Model Size (GB): 4.2
|
| 29 |
+
- Robustness (F1): 0.053
|
| 30 |
+
- **Confusion Matrix (Exact Matches)**:
|
| 31 |
+
- CSV: [confusion_matrix_exact.csv](confusion_matrix_exact.csv)
|
| 32 |
+
- Image: [confusion_matrix_exact.png](confusion_matrix_exact.png)
|
| 33 |
+
- **Confusion Matrix (Within ±1 Level)**:
|
| 34 |
+
- CSV: [confusion_matrix_within1.csv](confusion_matrix_within1.csv)
|
| 35 |
+
- Image: [confusion_matrix_within1.png](confusion_matrix_within1.png)
|
| 36 |
+
- **Per-Class Confusion Metrics (Exact Matches)**:
|
| 37 |
+
- A1: TP=0, FP=0, FN=10, TN=50
|
| 38 |
+
- A2: TP=10, FP=40, FN=0, TN=10
|
| 39 |
+
- B1: TP=0, FP=0, FN=10, TN=50
|
| 40 |
+
- B2: TP=0, FP=0, FN=10, TN=50
|
| 41 |
+
- C1: TP=0, FP=10, FN=10, TN=40
|
| 42 |
+
- C2: TP=0, FP=0, FN=10, TN=50
|
| 43 |
+
- **Per-Class Confusion Metrics (Within ±1 Level)**:
|
| 44 |
+
- A1: TP=10, FP=0, FN=0, TN=50
|
| 45 |
+
- A2: TP=10, FP=20, FN=0, TN=30
|
| 46 |
+
- B1: TP=10, FP=0, FN=0, TN=50
|
| 47 |
+
- B2: TP=0, FP=0, FN=10, TN=50
|
| 48 |
+
- C1: TP=0, FP=0, FN=10, TN=50
|
| 49 |
+
- C2: TP=10, FP=0, FN=0, TN=50
|
| 50 |
+
- **Usage**:
|
| 51 |
+
```python
|
| 52 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 53 |
+
|
| 54 |
+
model = AutoModelForCausalLM.from_pretrained("Mr-FineTuner/Test_02_gemma_trainPercen_myValidator")
|
| 55 |
+
tokenizer = AutoTokenizer.from_pretrained("Mr-FineTuner/Test_02_gemma_trainPercen_myValidator")
|
| 56 |
+
|
| 57 |
+
# Example inference
|
| 58 |
+
prompt = "<|user|>Generate a CEFR B1 level sentence.<|end|>"
|
| 59 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 60 |
+
outputs = model.generate(**inputs, max_length=50)
|
| 61 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Uploaded using `huggingface_hub`.
|
TEST_TRAIN_UNIFIEDDATASET_mistral_1epoch.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
adapter_config.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "unsloth/llama-3-8b-instruct-bnb-4bit",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"eva_config": null,
|
| 7 |
+
"exclude_modules": null,
|
| 8 |
+
"fan_in_fan_out": false,
|
| 9 |
+
"inference_mode": true,
|
| 10 |
+
"init_lora_weights": true,
|
| 11 |
+
"layer_replication": null,
|
| 12 |
+
"layers_pattern": null,
|
| 13 |
+
"layers_to_transform": null,
|
| 14 |
+
"loftq_config": {},
|
| 15 |
+
"lora_alpha": 32,
|
| 16 |
+
"lora_bias": false,
|
| 17 |
+
"lora_dropout": 0.5,
|
| 18 |
+
"megatron_config": null,
|
| 19 |
+
"megatron_core": "megatron.core",
|
| 20 |
+
"modules_to_save": null,
|
| 21 |
+
"peft_type": "LORA",
|
| 22 |
+
"r": 32,
|
| 23 |
+
"rank_pattern": {},
|
| 24 |
+
"revision": null,
|
| 25 |
+
"target_modules": [
|
| 26 |
+
"o_proj",
|
| 27 |
+
"gate_proj",
|
| 28 |
+
"down_proj",
|
| 29 |
+
"k_proj",
|
| 30 |
+
"v_proj",
|
| 31 |
+
"q_proj",
|
| 32 |
+
"up_proj"
|
| 33 |
+
],
|
| 34 |
+
"task_type": "CAUSAL_LM",
|
| 35 |
+
"use_dora": false,
|
| 36 |
+
"use_rslora": false
|
| 37 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19db9872bb5e393604cb42196c8a5de9c06c5d9d3fdc906cd7412013895abe92
|
| 3 |
+
size 167832688
|
config.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"MistralForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": 1,
|
| 7 |
+
"eos_token_id": 2,
|
| 8 |
+
"head_dim": 128,
|
| 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": 32,
|
| 17 |
+
"num_key_value_heads": 8,
|
| 18 |
+
"pad_token_id": 0,
|
| 19 |
+
"quantization_config": {
|
| 20 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
| 21 |
+
"bnb_4bit_quant_type": "nf4",
|
| 22 |
+
"bnb_4bit_use_double_quant": true,
|
| 23 |
+
"llm_int8_enable_fp32_cpu_offload": false,
|
| 24 |
+
"llm_int8_has_fp16_weight": false,
|
| 25 |
+
"llm_int8_skip_modules": null,
|
| 26 |
+
"llm_int8_threshold": 6.0,
|
| 27 |
+
"load_in_4bit": true,
|
| 28 |
+
"load_in_8bit": false,
|
| 29 |
+
"quant_method": "bitsandbytes"
|
| 30 |
+
},
|
| 31 |
+
"rms_norm_eps": 1e-05,
|
| 32 |
+
"rope_scaling": null,
|
| 33 |
+
"rope_theta": 10000.0,
|
| 34 |
+
"sliding_window": 4096,
|
| 35 |
+
"tie_word_embeddings": false,
|
| 36 |
+
"torch_dtype": "bfloat16",
|
| 37 |
+
"transformers_version": "4.51.3",
|
| 38 |
+
"unsloth_version": "2025.4.8",
|
| 39 |
+
"use_cache": true,
|
| 40 |
+
"vocab_size": 32000
|
| 41 |
+
}
|
confusion_matrix_exact.csv
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
,A1,A2,B1,B2,C1,C2
|
| 2 |
+
A1,0,10,0,0,0,0
|
| 3 |
+
A2,0,0,10,0,0,0
|
| 4 |
+
B1,0,0,10,0,0,0
|
| 5 |
+
B2,0,0,0,10,0,0
|
| 6 |
+
C1,0,0,0,0,10,0
|
| 7 |
+
C2,0,0,0,10,0,0
|
confusion_matrix_exact.png
ADDED
|
confusion_matrix_within1.csv
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
,A1,A2,B1,B2,C1,C2
|
| 2 |
+
A1,10,0,0,0,0,0
|
| 3 |
+
A2,0,10,0,0,0,0
|
| 4 |
+
B1,0,0,10,0,0,0
|
| 5 |
+
B2,0,0,0,10,0,0
|
| 6 |
+
C1,0,0,0,0,10,0
|
| 7 |
+
C2,0,0,0,10,0,0
|
confusion_matrix_within1.png
ADDED
|
generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"max_length": 32768,
|
| 6 |
+
"pad_token_id": 0,
|
| 7 |
+
"transformers_version": "4.51.3"
|
| 8 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c65a73bf847b3cac0655b74f77075bdd90456b4b7aa5890fce54327d20c4cc51
|
| 3 |
+
size 4125687910
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
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,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"additional_special_tokens": [],
|
| 32 |
+
"bos_token": "<s>",
|
| 33 |
+
"clean_up_tokenization_spaces": false,
|
| 34 |
+
"eos_token": "</s>",
|
| 35 |
+
"extra_special_tokens": {},
|
| 36 |
+
"legacy": false,
|
| 37 |
+
"model_max_length": 32768,
|
| 38 |
+
"pad_token": "<unk>",
|
| 39 |
+
"padding_side": "right",
|
| 40 |
+
"sp_model_kwargs": {},
|
| 41 |
+
"spaces_between_special_tokens": false,
|
| 42 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 43 |
+
"unk_token": "<unk>",
|
| 44 |
+
"use_default_system_prompt": false
|
| 45 |
+
}
|