Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,158 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- th
|
5 |
+
- en
|
6 |
+
library_name: transformers
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
tags:
|
9 |
+
- openthaigpt
|
10 |
+
- llama
|
11 |
---
|
12 |
+
|
13 |
+
# 🇹🇭 OpenThaiGPT 70b 1.0.0
|
14 |
+
![OpenThaiGPT](https://1173516064-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvvbWvIIe82Iv1yHaDBC5%2Fuploads%2Fb8eiMDaqiEQL6ahbAY0h%2Fimage.png?alt=media&token=6fce78fd-2cca-4c0a-9648-bd5518e644ce)
|
15 |
+
[More Info](https://openthaigpt.aieat.or.th/)
|
16 |
+
|
17 |
+
🇹🇭 OpenThaiGPT 70b Version 1.0.0 is a Thai language 70B-parameter LLaMA v2 Chat model finetuned to Thai instructions and extended with more than 10,000 most popular Thai words vocabularies into the LLM's dictionary for turbo speed.
|
18 |
+
|
19 |
+
## Features
|
20 |
+
- State-of-the-Art Thai language LLM, achieving the highest average score over all Thai opensource LLMs on 9 Thai language exams.
|
21 |
+
- Multi-turn Conversation Support
|
22 |
+
- Retrieval Augmented Generation (RAG) Support
|
23 |
+
|
24 |
+
|
25 |
+
## Benchmark by Multiple Choices Thai Exams
|
26 |
+
| **Exams** | **OTG 7b (Aug 2023)** | **OTG 13b (Dec 2023)** | **OTG 7b (March 2024)** | **OTG 13b (March 2024)** | **OTG 70b (March 2024)** | **SeaLLM 7b v1** | **SeaLLM 7b v2** | **TyphoonGPT 7b** | **SeaLion 7b** | **WanchanGLM 7b** | **Sailor-7B-Chat** | **GPT3.5** | **GPT4** | **Gemini Pro** | **Gemini 1.5** | **Claude 3 Haiku** | **Claude 3 Sonnet** | **Claude 3 Opus** |
|
27 |
+
|----------------------------------|-----------------------|------------------------|-------------------------|--------------------------|--------------------------|------------------|------------------|--------------------|----------------|-------------------|--------------------|------------|----------|----------------|----------------|--------------------|---------------------|-------------------|
|
28 |
+
| **A-Level** | 17.50% | 34.17% | 25.00% | 30.83% | **45.83%** | 18.33% | 34.17% | N/A* | 21.67% | 17.50% | 40.00% | 38.33% | 65.83% | 56.67% | 55.83% | 58.33% | 59.17% | 77.50% |
|
29 |
+
| **TGAT** | 24.00% | 22.00% | 22.00% | 36.00% | **36.00%** | 14.00% | 28.00% | N/A* | 24.00% | 16.00% | 34.00% | 28.00% | 44.00% | 22.00% | 28.00% | 36.00% | 34.00% | 46.00% |
|
30 |
+
| **TPAT1** | 22.50% | 47.50% | 42.50% | 27.50% | **62.50%** | 22.50% | 27.50% | N/A* | 22.50% | 17.50% | 40.00% | 45.00% | 52.50% | 52.50% | 50.00% | 52.50% | 50.00% | 62.50% |
|
31 |
+
| **ic_all_test** | 8.00% | 28.00% | 76.00% | 84.00% | **68.00%** | 16.00% | 28.00% | N/A* | 24.00% | 16.00% | 24.00% | 40.00% | 64.00% | 52.00% | 32.00% | 44.00% | 64.00% | 72.00% |
|
32 |
+
| **facebook_beleble_tha** | 25.00% | 45.00% | 34.50% | 39.50% | **70.00%** | 13.50% | 51.00% | N/A* | 27.00% | 24.50% | 63.00% | 50.00% | 72.50% | 65.00% | 74.00% | 63.50% | 77.00% | 90.00% |
|
33 |
+
| **xcopa_th_200** | 45.00% | 56.50% | 49.50% | 51.50% | **74.50%** | 26.50% | 47.00% | N/A* | 51.50% | 48.50% | 68.50% | 64.00% | 82.00% | 68.00% | 74.00% | 64.00% | 80.00% | 86.00% |
|
34 |
+
| **xnli2.0_tha** | 33.50% | 34.50% | 39.50% | 31.00% | **47.00%** | 21.00% | 43.00% | N/A* | 37.50% | 33.50% | 16.00% | 50.00% | 69.00% | 53.00% | 54.50% | 50.00% | 68.00% | 68.50% |
|
35 |
+
| **ONET M3** | 17.85% | 38.86% | 34.11% | 39.36% | 56.15% | **15.58%** | 23.92% | N/A* | 21.79% | 19.56% | 21.37% | 37.91% | 49.97% | 55.99% | 57.41% | 52.73% | 40.60% | 63.87% |
|
36 |
+
| **ONET M6** | 21.14% | 28.87% | 22.53% | 23.32% | 42.85% | **15.09%** | 19.48% | N/A* | 16.96% | 20.67% | 28.64% | 34.44% | 46.29% | 45.53% | 50.23% | 34.79% | 38.49% | 48.56% |
|
37 |
+
| **Average Score** | 23.83% | 37.27% | 38.40% | 40.33% | **55.87%** | 18.06% | 33.56% | N/A* | 27.44% | 23.75% | 37.28% | 43.07% | 60.68% | 52.30% | 52.89% | 50.65% | 56.81% | 68.32% |
|
38 |
+
|
39 |
+
\*Waiting for accessing TyphoonGPT Instruct Model.
|
40 |
+
|
41 |
+
(More benchmark is coming soon)
|
42 |
+
|
43 |
+
### Benchmark Configuration
|
44 |
+
- Clearly instruct model to answer by select from possible choices and followed by an explanation.
|
45 |
+
- Zero shot only
|
46 |
+
- Tested on Unseen test set only
|
47 |
+
- Detect a multi-choice answer on (A),(B),(C),(D),(E) at the beginning of the answer (First priority) and at the end of the answer (Second priority)
|
48 |
+
|
49 |
+
## Licenses
|
50 |
+
**Source Code**: License Apache Software License 2.0.<br>
|
51 |
+
**Weight**: Research and **Commercial uses**.<br>
|
52 |
+
|
53 |
+
## Sponsors
|
54 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/5fcd9c426d942eaf4d1ebd30/42d-GioSs4evIdNuMAaPB.png" width="600px">
|
55 |
+
|
56 |
+
## Supports
|
57 |
+
- Official website: https://openthaigpt.aieat.or.th
|
58 |
+
- Facebook page: https://web.facebook.com/groups/openthaigpt
|
59 |
+
- A Discord server for discussion and support [here](https://discord.gg/rUTp6dfVUF)
|
60 |
+
- E-mail: [email protected]
|
61 |
+
|
62 |
+
|
63 |
+
## Prompt Format
|
64 |
+
Prompt format is based on Llama2 with a small modification (Adding "###" to specify the context part)
|
65 |
+
```
|
66 |
+
<s>[INST] <<SYS>
|
67 |
+
{system_prompt}
|
68 |
+
<</SYS>>
|
69 |
+
|
70 |
+
{human_turn1}###{context_turn1} [/INST]{assistant_turn1}</s><s>{human_turn2}###{context_turn2} [/INST] ...
|
71 |
+
```
|
72 |
+
|
73 |
+
Practically, when usually used "\n" for a new line so,
|
74 |
+
```
|
75 |
+
<s>[INST] <<SYS>\n{system_prompt}\n<</SYS>>\n\n{human_turn1}###{context_turn1} [/INST]{assistant_turn1}</s><s>{human_turn2}###{context_turn2} [/INST] ...
|
76 |
+
```
|
77 |
+
|
78 |
+
### System prompt:
|
79 |
+
```
|
80 |
+
You are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด
|
81 |
+
```
|
82 |
+
|
83 |
+
### Examples
|
84 |
+
|
85 |
+
#### Single Turn Conversation Example
|
86 |
+
```
|
87 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nสวัสดีครับ [/INST]
|
88 |
+
```
|
89 |
+
|
90 |
+
#### Single Turn Conversation with Context (RAG) Example
|
91 |
+
```
|
92 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nกรุงเทพมีพื้นที่เท่าไร่###กรุงเทพมหานคร เป็นเมืองหลวง นครและมหานครที่มีประชากรมากที่สุดของประเทศไทย กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม. มีประชากรตามทะเบียนราษฎรกว่า 8 ล้านคน [/INST]
|
93 |
+
```
|
94 |
+
|
95 |
+
#### Multi Turn Conversation Example
|
96 |
+
|
97 |
+
##### First turn
|
98 |
+
```
|
99 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nสวัสดีครับ [/INST]
|
100 |
+
```
|
101 |
+
|
102 |
+
##### Second turn
|
103 |
+
```
|
104 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nสวัสดีครับ [/INST]สวัสดีค่ะ มีคำถามอะไร ถามได้เลย</s><s>ขอสูตรทำส้มตำหน่อย [/INST]
|
105 |
+
```
|
106 |
+
|
107 |
+
##### Third turn
|
108 |
+
```
|
109 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน��ที่สุด\n<</SYS>>\n\nสวัสดีครับ [/INST]สวัสดีค่ะ มีคำถามอะไร ถามได้เลย</s><s>ขอสูตรทำส้มตำหน่อย [/INST]ได้เลยค่ะ ส้มตำเป็นเมนูที่ทำง่ายและอร่อย มาเริ่มกันเลยนะคะ</s><s>เริ่มได้เลย [/INST]
|
110 |
+
```
|
111 |
+
|
112 |
+
##### Fourth turn
|
113 |
+
```
|
114 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nสวัสดีครับ [/INST]สวัสดีค่ะ มีคำถามอะไร ถามได้เลย</s><s>ขอสูตรทำส้มตำหน่อย [/INST]ได้เลยค่ะ ส้มตำเป็นเมนูที่ทำง่ายและอร่อย มาเริ่มกันเลยนะคะ</s><s>เริ่มได้เลย [/INST]ตำไทยเป็นเมนูที่ใครๆ ก็คุ้นเคย ด้วยรสชาติที่กลมกล่อม หวาน เปรี้ยว เค็ม เผ็ด ครบรส วันนี้เราจะมาทำส้มตำด้วยกันค่ะ สิ่งแรกที่ต้องมีคือเครื่องปรุงดังนี้ - มะละกอดิบ 1 ลูก - กุ้งแห้ง 1/2 ถ้วย - กระเทียม 3 กลีบ - พริกขี้หนู 3 เม็ด - น้ำตาลปี๊บ 1 ช้อนโต๊ะ - น้ำปลา 2 ช้อนโต๊ะ - มะนาว 1 ลูก - งาขาวคั่ว 1/4 ถ้วย วิธีทำมีดังนี้ค่ะ 1. เริ่มจากล้างมะละกอให้สะอาด แล้วใช้มีดปอกเปลือก เอาไส้ออก หั่นเป็นเส้นบางๆ เตรียมไว้ 2. ตำกุ้งแห้งให้ละเอียด แล้วตักขึ้นพักไว้ 3. ใช้ครกหินหรือเครื่องปั่น บดพริกขี้หนูกับกระเทียมให้ละเอียด 4. ใส่กุ้งแห้งที่ตำแล้วลงไปผสม ตามด้วยน้ำตาลปี๊บ น้ำปลา มะนาว และเส้นมะละกอ คลุกเคล้าให้เข้ากัน 5. ชิมรสให้ได้รสหวาน เปรี้ยว เค็ม เผ็ด จากนั้นตักขึ้นเสิร์ฟพร้อมผักสด อาทิ กะหล่ำปลี ถั่วงอก แครอท ผักบุ้ง</s><s>ขอบคุณครับ [/INST]
|
115 |
+
```
|
116 |
+
|
117 |
+
#### Multi Turn Conversation with Context (RAG) Example
|
118 |
+
```
|
119 |
+
<s>[INST] <<SYS>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nกรุงเทพมีพื้นที่เท่าไร่###กรุงเทพมหานคร เป็นเมืองหลวง นครและมหานครที่มีประชากรมากที่สุดของประเทศไทย กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม. มีประชากรตามทะเบียนราษฎรกว่า 8 ล้านคน [/INST]กรุงเทพมหานครมีพื้นที่ทั้งหมด 1,568.737 ตร.กม.</s><s>และประชากรล่ะ [/INST]
|
120 |
+
```
|
121 |
+
|
122 |
+
## How to use
|
123 |
+
|
124 |
+
### vLLM Engine for float16 model
|
125 |
+
|
126 |
+
1. install VLLM (https://github.com/vllm-project/vllm)
|
127 |
+
2. python -m vllm.entrypoints.api_server --model /path/to/model --tensor-parallel-size num_gpus
|
128 |
+
3. run inference (CURL example)
|
129 |
+
|
130 |
+
```
|
131 |
+
curl --request POST \
|
132 |
+
--url http://localhost:8000/generate \
|
133 |
+
--header "Content-Type: application/json" \
|
134 |
+
--data '{"prompt": "<s>[INST] <<SYS>>\nYou are a question answering assistant. Answer the question as truthful and helpful as possible คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด\n<</SYS>>\n\nอยากลดความอ้วนต้องทำอย่างไร [/INST]","use_beam_search": false, "temperature": 0.1, "max_tokens": 512, "top_p": 0.75, "top_k": 40, "frequency_penalty": 0.3 "stop": "</s>"}'
|
135 |
+
```
|
136 |
+
|
137 |
+
### LlamaCPP Engine for 4 bit model
|
138 |
+
|
139 |
+
|
140 |
+
### Authors
|
141 |
+
* Kobkrit Viriyayudhakorn ([email protected])
|
142 |
+
* Sumeth Yuenyong ([email protected])
|
143 |
+
* Thaweewat Rugsujarit ([email protected])
|
144 |
+
* Jillaphat Jaroenkantasima ([email protected])
|
145 |
+
* Norapat Buppodom ([email protected])
|
146 |
+
* Koravich Sangkaew ([email protected])
|
147 |
+
* Peerawat Rojratchadakorn ([email protected])
|
148 |
+
* Surapon Nonesung ([email protected])
|
149 |
+
* Chanon Utupon ([email protected])
|
150 |
+
* Sadhis Wongprayoon ([email protected])
|
151 |
+
* Nucharee Thongthungwong ([email protected])
|
152 |
+
* Chawakorn Phiantham ([email protected])
|
153 |
+
* Patteera Triamamornwooth ([email protected])
|
154 |
+
* Nattarika Juntarapaoraya ([email protected])
|
155 |
+
* Kriangkrai Saetan ([email protected])
|
156 |
+
* Pitikorn Khlaisamniang ([email protected])
|
157 |
+
|
158 |
+
<i>Disclaimer: Provided responses are not guaranteed.</i>
|