Update README.md
Browse files
README.md
CHANGED
@@ -9,8 +9,64 @@ tags:
|
|
9 |
- unsloth
|
10 |
- llama
|
11 |
- trl
|
|
|
|
|
12 |
---
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# Uploaded model
|
15 |
|
16 |
- **Developed by:** Konthee
|
@@ -19,4 +75,4 @@ tags:
|
|
19 |
|
20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
-
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
9 |
- unsloth
|
10 |
- llama
|
11 |
- trl
|
12 |
+
datasets:
|
13 |
+
- airesearch/WangchanThaiInstruct
|
14 |
---
|
15 |
|
16 |
+
# Dataset
|
17 |
+
|
18 |
+
This model finetune on [airesearch/WangchanThaiInstruct](https://huggingface.co/datasets/airesearch/WangchanThaiInstruct)
|
19 |
+
|
20 |
+
`23 sep 2024`
|
21 |
+
|
22 |
+
Training details:
|
23 |
+
|
24 |
+
- epochs: 1
|
25 |
+
- learning rate: 2e-4
|
26 |
+
- learning rate scheduler type: linear
|
27 |
+
- Warmup ratio: 0.3
|
28 |
+
- cutoff len (i.e. context length): 2048
|
29 |
+
- global batch size: 8
|
30 |
+
- fine-tuning type: qlora
|
31 |
+
- optimizer: adamw_8bit
|
32 |
+
|
33 |
+
ps. 12 Hours from T4 Kaggle
|
34 |
+
|
35 |
+
|
36 |
+
# Usage
|
37 |
+
|
38 |
+
|
39 |
+
```python
|
40 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
41 |
+
|
42 |
+
model_id = "Konthee/Llama-3.1-8B-ThaiInstruct"
|
43 |
+
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
45 |
+
model = AutoModelForCausalLM.from_pretrained(
|
46 |
+
model_id, torch_dtype="auto", device_map="auto"
|
47 |
+
)
|
48 |
+
|
49 |
+
messages = [
|
50 |
+
{"role": "user", "content": "สอนภาษาไทยหน่อย"},
|
51 |
+
]
|
52 |
+
|
53 |
+
input_ids = tokenizer.apply_chat_template(
|
54 |
+
messages, add_generation_prompt=True, return_tensors="pt"
|
55 |
+
).to(model.device)
|
56 |
+
|
57 |
+
outputs = model.generate(
|
58 |
+
input_ids,
|
59 |
+
max_new_tokens=8192,
|
60 |
+
do_sample=True,
|
61 |
+
temperature=0.6,
|
62 |
+
top_p=0.9,
|
63 |
+
)
|
64 |
+
response = outputs[0][input_ids.shape[-1]:]
|
65 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
66 |
+
```
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
# Uploaded model
|
71 |
|
72 |
- **Developed by:** Konthee
|
|
|
75 |
|
76 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
77 |
|
78 |
+
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|