File size: 2,183 Bytes
ce904d7
 
f5265d5
 
 
 
 
 
 
 
 
ce904d7
 
f5265d5
ce904d7
 
 
f5265d5
 
 
 
 
 
 
 
 
ce904d7
 
 
f5265d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
library_name: transformers
license: mit
datasets:
- heegyu/open-korean-instructions
language:
- ko
tags:
- Llama-3
- LoRA
- MLP-KTLim/llama-3-Korean-Bllossom-8B
---

# MLP-KTLim/llama-3-Korean-Bllossom-8B model fine tuning (TREX-Lab at Seoul Cyber University)

<!-- Provide a quick summary of what the model is/does. -->

## Summary
  - Base Model : MLP-KTLim/llama-3-Korean-Bllossom-8B
  - Dataset : heegyu/open-korean-instructions (10%)
  - Tuning Method
    - PEFT(Parameter Efficient Fine-Tuning)
    - LoRA(Low-Rank Adaptation of Large Language Models)
  - Related Articles : https://arxiv.org/abs/2106.09685, https://arxiv.org/pdf/2403.10882
  - Fine-tuning the Base Model with a random 10% of Korean chatbot data (open Korean instructions)
  - Test whether fine tuning of a large language model is possible on A30 GPU*1 (successful)

<!-- Provide a longer summary of what this model is. -->

- **Developed by:** [TREX-Lab at Seoul Cyber University]
- **Language(s) (NLP):** [Korean]
- **Finetuned from model :** [MLP-KTLim/llama-3-Korean-Bllossom-8B]

## Fine Tuning Detail

- alpha value 16
- r value 64 (it seems a bit big...@@)
```
peft_config = LoraConfig(
    lora_alpha=16,
    lora_dropout=0.1,
    r=64,
    bias='none',
    task_type='CAUSAL_LM'
)
```

- Mixed precision : 4bit (bnb_4bit_use_double_quant)
```
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type='nf4',
    bnb_4bit_compute_dtype='float16',
)
```

- Use SFT trainer (https://huggingface.co/docs/trl/sft_trainer)
```
trainer = SFTTrainer(
    model=peft_model,
    train_dataset=dataset,
    dataset_text_field='text',
    max_seq_length=min(tokenizer.model_max_length, 2048),
    tokenizer=tokenizer,
    packing=True,
    args=training_args
)
```

### Train Result

```
time taken : executed in 21h 45m 55s
```

```
TrainOutput(global_step=816, training_loss=1.718194248045192,
            metrics={'train_runtime': 78354.6002,
                     'train_samples_per_second': 0.083,
                     'train_steps_per_second': 0.01,
                     'train_loss': 1.718194248045192,
                     'epoch': 2.99})

```