File size: 3,329 Bytes
6055ca3
 
fbeac15
 
 
 
 
 
04d745a
fbeac15
 
04d745a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6055ca3
 
fbeac15
6055ca3
fbeac15
 
6055ca3
fbeac15
6055ca3
fbeac15
 
6055ca3
fbeac15
 
6055ca3
fbeac15
 
 
6055ca3
fbeac15
 
 
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
 
 
6055ca3
fbeac15
6055ca3
fbeac15
fe262c9
 
 
 
fbeac15
 
6055ca3
fbeac15
 
 
 
 
 
 
 
 
 
 
 
 
6055ca3
fbeac15
 
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
6055ca3
fbeac15
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
library_name: transformers
tags:
- thai
- opt
- generative ai
- SEA
- southeast-asian
- nlp
license: mit
language:
- the
widget:
- text: 'User: อะไรคือวิธีที่ดีที่สุดในการทําความสะอาดพรม Assistant:'
  example_title: Example 1
- text: >-
    User: ทําไมเครื่องตรวจจับควันถึงส่งเสียงบี๊บเมื่อแบตเตอรี่เหลือน้อย
    Assistant:
  example_title: Example 2
- text: 'User: เมื่อไหร่จะเป็นเวลาที่ดีที่สุดของปีที่จะจองล่องเรือ? Assistant:'
  example_title: Example 3
- text: >-
    User: ฉันต้องการใช้โฟโต้ชอป แต่ฉันไม่คุ้นเคยกับซอฟต์แวร์
    คุณช่วยแนะนําบทเรียนเบื้องต้นเพื่อช่วยฉันให้เร็วขึ้นหน่อยได้ไหม? Assistant:
  example_title: Example 4
- text: 'User: ฉันควรทําอย่างไรถ้าฉันเจอหมีขณะตั้งแคมป์? Assistant:'
  example_title: Example 5
---

![thai-opt350m-instruct-logo](thai-opt350m.png)

# thai-opt350m-instruct
 a generative language model for thai language based on opt350m

**Thai-OPT350M-Instruct** is a fine-tuned pretrained transformer for **thai language** based on facebook/opt-350m.

Dataset for thai-opt350m-instruct
- yadapruk/thai-instructions-rallio

## Base Model
- Facebook Open Pretrained Transformer

## Languages 
- mainly support Thai Language
- a few English, Chinese, Arabic

## Training
- epochs - 12
- training loss - 0.809200

# Model Page

[https://huggingface.co/jojo-ai-mst/thai-opt350m-instruct](https://huggingface.co/jojo-ai-mst/thai-opt350m-instruct)

## Prompt Format

```
User: อะไรคือวิธีที่ดีที่สุดในการทําความสะอาดพรม Assistant:
```

# How to use

```python
# pip install transformers

from transformers import AutoModelForCausalLM,AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("jojo-ai-mst/thai-opt350m-instruct")
tokenizer = AutoTokenizer.from_pretrained("jojo-ai-mst/thai-opt350m-instruct")

def generate_text(prompt, max_length=200, temperature=0.8, top_k=50):
    input_ids = tokenizer.encode(prompt, return_tensors="pt").cuda() # remove .cuda() if only cpu
    output = model.generate(
        input_ids,
        max_length=max_length,
        temperature=temperature,
        top_k=top_k,
        pad_token_id=tokenizer.eos_token_id,
        do_sample=True
    )
    for result in output:
      generated_text = tokenizer.decode(result, skip_special_tokens=True)
      print(generated_text)

generate_text("User: อะไรคือวิธีที่ดีที่สุดในการทําความสะอาดพรม Assistant:")
```

# Date of Release 

22/03/2024

# License

MIT

# Author

[Min Si Thu](https://www.linkedin.com/in/min-si-thu/)

# Notes

This ai model is a movement of [MyanmarGPT-Movement](https://github.com/MyanmarGPT-Movement).