File size: 1,797 Bytes
5276e4c
 
 
 
 
 
 
 
 
 
 
ce87f00
 
5276e4c
 
ce87f00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5276e4c
 
 
 
 
 
 
 
ce87f00
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
---
base_model: unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit
language:
- en
license: apache-2.0
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
datasets:
- airesearch/WangchanThaiInstruct
---

# Dataset

This model finetune on [airesearch/WangchanThaiInstruct](https://huggingface.co./datasets/airesearch/WangchanThaiInstruct) 

`23 sep 2024`

Training details:

- epochs: 1
- learning rate: 2e-4
- learning rate scheduler type: linear
- Warmup ratio: 0.3
- cutoff len (i.e. context length): 2048
- global batch size: 8
- fine-tuning type: qlora
- optimizer: adamw_8bit

ps. 12 Hours from T4 Kaggle


# Usage


```python
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "Konthee/Llama-3.1-8B-ThaiInstruct"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, torch_dtype="auto", device_map="auto"
)

messages = [
    {"role": "user", "content": "สอนภาษาไทยหน่อย"},
]

input_ids = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)

outputs = model.generate(
    input_ids,
    max_new_tokens=8192,
    do_sample=True,
    temperature=0.6,
    top_p=0.9,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
```



# Uploaded  model

- **Developed by:** Konthee
- **License:** apache-2.0
- **Finetuned from model :** unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit

This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)