Update README.md
Browse files
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
base_model: unsloth/meta-llama-3.1-8b-instruct-bnb-4bit
|
3 |
language:
|
4 |
- en
|
5 |
-
license:
|
6 |
tags:
|
7 |
- text-generation-inference
|
8 |
- transformers
|
@@ -10,14 +10,95 @@ tags:
|
|
10 |
- llama
|
11 |
- trl
|
12 |
- sft
|
|
|
|
|
13 |
---
|
14 |
|
15 |
-
#
|
16 |
|
17 |
-
|
18 |
-
- **License:** apache-2.0
|
19 |
-
- **Finetuned from model :** unsloth/meta-llama-3.1-8b-instruct-bnb-4bit
|
20 |
|
21 |
-
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
base_model: unsloth/meta-llama-3.1-8b-instruct-bnb-4bit
|
3 |
language:
|
4 |
- en
|
5 |
+
license: mit
|
6 |
tags:
|
7 |
- text-generation-inference
|
8 |
- transformers
|
|
|
10 |
- llama
|
11 |
- trl
|
12 |
- sft
|
13 |
+
datasets:
|
14 |
+
- LimYeri/LeetCode_Python_Solutions_Data
|
15 |
---
|
16 |
|
17 |
+
# CodeMind-Llama3.1-8B-unsloth
|
18 |
|
19 |
+
**Codemind Project** is a language model developed to assist in solving and learning coding test problems. This model is fine-tuned using posts written by LeetCode users as training data, aiming to provide answers specialized for coding tests.
|
|
|
|
|
20 |
|
|
|
21 |
|
22 |
+
## Model Information
|
23 |
+
- **Base Model**: `meta-llama/Meta-Llama-3.1-8B-Instruct`
|
24 |
+
- **Fine-Tuning**: Fine-tuned using the unsloth library based on the `unsloth/Meta-Llama-3.1-8B-Instruct` model
|
25 |
+
- **Fine-Tuning Process**: Conducted with reference to the Llama 3.1 Conversational_notebook
|
26 |
+
|
27 |
+
|
28 |
+
## Dataset Used
|
29 |
+
- LeetCode Python Solutions Dataset: [LeetCode_Python_Solutions_Data](https://huggingface.co/datasets/LimYeri/LeetCode_Python_Solutions_Data)
|
30 |
+
|
31 |
+
|
32 |
+
## How to Use the Model
|
33 |
+
This model is accessible through HuggingFace's model hub and can be integrated into applications using the API. It is designed to generate explanations, code snippets, or guides for coding problems or programming-related questions.
|
34 |
+
|
35 |
+
```python
|
36 |
+
# ์์ธํ ์ฌํญ์ demo-Llama3.1.ipynb ํ์ธ
|
37 |
+
from unsloth import FastLanguageModel
|
38 |
+
from unsloth.chat_templates import get_chat_template
|
39 |
+
from IPython.display import display, Markdown
|
40 |
+
|
41 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
42 |
+
model_name = "LimYeri/CodeMind-Llama3.1-8B-unsloth", # YOUR MODEL YOU USED FOR TRAINING
|
43 |
+
max_seq_length = max_seq_length,
|
44 |
+
dtype = dtype,
|
45 |
+
load_in_4bit = load_in_4bit,
|
46 |
+
)
|
47 |
+
|
48 |
+
tokenizer = get_chat_template(
|
49 |
+
tokenizer,
|
50 |
+
chat_template = "llama-3.1",
|
51 |
+
)
|
52 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
53 |
+
|
54 |
+
messages = [
|
55 |
+
{"role": "system", "content": "You are a kind coding test teacher."},
|
56 |
+
{"role": "user", "content": "Enter your coding problem or question here."},
|
57 |
+
]
|
58 |
+
inputs = tokenizer.apply_chat_template(
|
59 |
+
messages,
|
60 |
+
tokenize = True,
|
61 |
+
add_generation_prompt = True, # Must add for generation
|
62 |
+
return_tensors = "pt",
|
63 |
+
).to("cuda")
|
64 |
+
|
65 |
+
outputs = model.generate(input_ids = inputs, max_new_tokens = 3000, use_cache = True,
|
66 |
+
temperature = 0.5, min_p = 0.3) # Feel free to adjust the temperature and min_p
|
67 |
+
text = (tokenizer.batch_decode(outputs))[0].split('assistant<|end_header_id|>\n\n')[1].strip()
|
68 |
+
display(Markdown(text))
|
69 |
+
```
|
70 |
+
|
71 |
+
## LoRA Configuration
|
72 |
+
- **r**: 16
|
73 |
+
- **lora_alpha**: 16
|
74 |
+
- **lora_dropout**: 0
|
75 |
+
- **bias**: "none"
|
76 |
+
- **use_gradient_checkpointing**: "unsloth"
|
77 |
+
|
78 |
+
## Training Settings
|
79 |
+
- **Per Device Train Batch Size**: 8
|
80 |
+
- **Gradient Accumulation Steps**: 2
|
81 |
+
- **Warmup Steps**: 200
|
82 |
+
- **Number of Training Epochs**: 5
|
83 |
+
- **Learning Rate**: 2e-4
|
84 |
+
- **fp16**: not `is_bfloat16_supported()`
|
85 |
+
- **bf16**: `is_bfloat16_supported()`
|
86 |
+
- **Logging Steps**: 20
|
87 |
+
- **Optimizer**: "adamw_8bit"
|
88 |
+
- **Weight Decay**: 0.01
|
89 |
+
- **LR Scheduler Type**: "linear"
|
90 |
+
|
91 |
+
## Evaluation Results [Open LLM Leaderboard](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard)
|
92 |
+
| Metric | Value |
|
93 |
+
|--------------|--------|
|
94 |
+
| Average | 22.17 |
|
95 |
+
| IFEval | 64.9 |
|
96 |
+
| BBH | 24.19 |
|
97 |
+
| MATH Lvl 5 | 9.97 |
|
98 |
+
| GPQA | 1.9 |
|
99 |
+
| MUSR | 6.04 |
|
100 |
+
| MMLU-PRO | 26 |
|
101 |
+
|
102 |
+
|
103 |
+
## Fine-Tuning Code
|
104 |
+
Detailed fine-tuning code and settings can be found in the [CodeMind-Extended GitHub repository](https://github.com/LimYeri/CodeMind-Extended).
|