RichardErkhov
commited on
Commit
•
8e58d74
1
Parent(s):
9291688
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
llama-3-typhoon-v1.5x-70b-instruct - GGUF
|
11 |
+
- Model creator: https://huggingface.co/scb10x/
|
12 |
+
- Original model: https://huggingface.co/scb10x/llama-3-typhoon-v1.5x-70b-instruct/
|
13 |
+
|
14 |
+
|
15 |
+
| Name | Quant method | Size |
|
16 |
+
| ---- | ---- | ---- |
|
17 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q2_K.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.Q2_K.gguf) | Q2_K | 24.56GB |
|
18 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.IQ3_XS.gguf) | IQ3_XS | 27.29GB |
|
19 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.IQ3_S.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.IQ3_S.gguf) | IQ3_S | 28.79GB |
|
20 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.Q3_K_S.gguf) | Q3_K_S | 28.79GB |
|
21 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.IQ3_M.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.IQ3_M.gguf) | IQ3_M | 29.74GB |
|
22 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q3_K.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.Q3_K.gguf) | Q3_K | 31.91GB |
|
23 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.Q3_K_M.gguf) | Q3_K_M | 31.91GB |
|
24 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.Q3_K_L.gguf) | Q3_K_L | 34.59GB |
|
25 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.IQ4_XS.gguf) | IQ4_XS | 35.64GB |
|
26 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q4_0.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/blob/main/llama-3-typhoon-v1.5x-70b-instruct.Q4_0.gguf) | Q4_0 | 37.22GB |
|
27 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | IQ4_NL | 37.58GB |
|
28 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q4_K_S | 37.58GB |
|
29 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q4_K.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q4_K | 39.6GB |
|
30 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q4_K_M | 39.6GB |
|
31 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q4_1.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q4_1 | 41.27GB |
|
32 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q5_0.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q5_0 | 45.32GB |
|
33 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q5_K_S | 45.32GB |
|
34 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q5_K.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q5_K | 46.52GB |
|
35 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q5_K_M | 46.52GB |
|
36 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q5_1.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q5_1 | 49.36GB |
|
37 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q6_K.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q6_K | 53.91GB |
|
38 |
+
| [llama-3-typhoon-v1.5x-70b-instruct.Q8_0.gguf](https://huggingface.co/RichardErkhov/scb10x_-_llama-3-typhoon-v1.5x-70b-instruct-gguf/tree/main/) | Q8_0 | 69.83GB |
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
Original model description:
|
44 |
+
---
|
45 |
+
language:
|
46 |
+
- th
|
47 |
+
- en
|
48 |
+
pipeline_tag: text-generation
|
49 |
+
license: llama3
|
50 |
+
---
|
51 |
+
**Llama-3-Typhoon-1.5X-70B-instruct: Thai Large Language Model (Instruct)**
|
52 |
+
|
53 |
+
**Llama-3-Typhoon-1.5X-70B-instruct** is a 70 billion parameter instruct model designed for Thai 🇹🇭 language. It demonstrates competitive performance with GPT-4-0612, and is optimized for **application** use cases, **Retrieval-Augmented Generation (RAG), constrained generation**, and **reasoning** tasks.
|
54 |
+
|
55 |
+
Built on Typhoon 1.5 70B (not yet released) and Llama 3 70B Instruct. this model is a result of our experiment on **cross-lingual transfer**. It utilizes the [task-arithmetic model editing](https://arxiv.org/abs/2212.04089) technique, combining the Thai understanding capability of Typhoon with the human alignment performance of Llama 3 Instruct.
|
56 |
+
|
57 |
+
Remark: To acknowledge Meta's efforts in creating the foundation model and comply with the license, we explicitly include "llama-3" in the model name.
|
58 |
+
|
59 |
+
## **Model Description**
|
60 |
+
|
61 |
+
- **Model type**: A 70B instruct decoder-only model based on the Llama architecture
|
62 |
+
- **Requirement**: Transformers 4.38.0 or newer
|
63 |
+
- **Primary Language(s)**: Thai 🇹🇭 and English 🇬🇧
|
64 |
+
- **License**: [**Llama 3 Community License**](https://llama.meta.com/llama3/license/)
|
65 |
+
|
66 |
+
## **Performance**
|
67 |
+
|
68 |
+
We evaluated the model's performance in **Language & Knowledge Capabilities** and **Instruction Following Capabilities**.
|
69 |
+
|
70 |
+
- **Language & Knowledge Capabilities**:
|
71 |
+
- Assessed using multiple-choice question-answering datasets such as ThaiExam and MMLU.
|
72 |
+
- **Instruction Following Capabilities**:
|
73 |
+
- Evaluated based on beta users' feedback, focusing on two factors:
|
74 |
+
- **Human Alignment & Reasoning**: Ability to generate responses that are clear and logically structured across multiple steps.
|
75 |
+
- Evaluated using [MT-Bench](https://arxiv.org/abs/2306.05685) — How LLMs can align with human needs.
|
76 |
+
- **Instruction-following**: Ability to adhere to specified constraints in the instructions.
|
77 |
+
- Evaluated using [IFEval](https://arxiv.org/abs/2311.07911) — How LLMs can follow specified constraints, such as formatting and brevity.
|
78 |
+
- **Agentic Capabilities**:
|
79 |
+
- Evaluated in agent use-cases using [Hugging Face's Transformer Agents](https://huggingface.co/blog/agents) and the associated [benchmark](https://huggingface.co/blog/open-source-llms-as-agents).
|
80 |
+
|
81 |
+
Remark: We developed the Thai (TH) pairs by translating the original datasets into Thai through machine and human methods.
|
82 |
+
|
83 |
+
### ThaiExam
|
84 |
+
|
85 |
+
| Model | ONET | IC | TGAT | TPAT-1 | A-Level | Average (ThaiExam) | MMLU |
|
86 |
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
87 |
+
| Typhoon-1.5X 70B | **0.565** | 0.68 | **0.778** | **0.517** | 0.56 | **0.620** | 0.7945 |
|
88 |
+
| gpt-4-0612 | 0.493 | **0.69** | 0.744 | 0.509 | **0.616** | 0.610 | **0.864**** |
|
89 |
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
90 |
+
| gpt-4o | 0.62 | 0.63 | 0.789 | 0.56 | 0.623 | 0.644 | 0.887** |
|
91 |
+
|
92 |
+
** We report the MMLU score that is reported in [GPT-4o Tech Report](https://openai.com/index/hello-gpt-4o/).
|
93 |
+
|
94 |
+
### MT-Bench
|
95 |
+
|
96 |
+
| Model | MT-Bench Thai | MT-Bench English |
|
97 |
+
| --- | --- | --- |
|
98 |
+
| Typhoon-1.5X 70B | **8.029** | **8.797** |
|
99 |
+
| gpt-4-0612 | 7.801 | 8.671 |
|
100 |
+
| --- | --- | --- |
|
101 |
+
| gpt-4o | 8.514 | 9.184 |
|
102 |
+
|
103 |
+
### IFEval
|
104 |
+
|
105 |
+
| Model | IFEval Thai | IFEval English |
|
106 |
+
| --- | --- | --- |
|
107 |
+
| Typhoon-1.5X 70B | **0.645** | **0.810** |
|
108 |
+
| gpt-4-0612 | 0.612 | 0.793* |
|
109 |
+
| --- | --- | --- |
|
110 |
+
| gpt-4o | 0.737 | 0.871 |
|
111 |
+
|
112 |
+
* We report the number from IFEval paper.
|
113 |
+
|
114 |
+
### Agent
|
115 |
+
|
116 |
+
| Model | GAIA - Thai/English | GSM8K - Thai/English | HotpotQA - Thai/English |
|
117 |
+
| --- | --- | --- | --- |
|
118 |
+
| gpt-3.5-turbo-0125 | **18.42**/37.5 | 70/80 | 39.56/59 |
|
119 |
+
| Typhoon-1.5X 70B | 17.10/36.25 | 80/95 | 52.7/65.83 |
|
120 |
+
| gpt-4-0612 | 17.10/**38.75** | **90**/**100** | **56.41**/**76.25** |
|
121 |
+
| --- | --- | --- | --- |
|
122 |
+
| gpt-4o | 44.73/57.5 | 100/100 | 71.64/76.58 |
|
123 |
+
|
124 |
+
## Insight
|
125 |
+
|
126 |
+
We utilized **model editing** techniques and found that the most critical feature for generating accurate Thai answers is located in the backend (the upper layers of the transformer block). Accordingly, we incorporated a high ratio of Typhoon components in these backend layers to enhance our model’s performance.
|
127 |
+
|
128 |
+
## **Usage Example**
|
129 |
+
|
130 |
+
```python
|
131 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
132 |
+
import torch
|
133 |
+
|
134 |
+
model_id = "scb10x/llama-3-typhoon-v1.5x-70b-instruct"
|
135 |
+
|
136 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
137 |
+
model = AutoModelForCausalLM.from_pretrained(
|
138 |
+
model_id,
|
139 |
+
torch_dtype=torch.bfloat16,
|
140 |
+
device_map="auto",
|
141 |
+
) # We don't recommend using BNB 4-bit (load_in_4bit) here. Instead, use AWQ, as detailed here: https://huggingface.co/scb10x/llama-3-typhoon-v1.5x-70b-instruct-awq.
|
142 |
+
|
143 |
+
messages = [...] # add message here
|
144 |
+
|
145 |
+
input_ids = tokenizer.apply_chat_template(
|
146 |
+
messages,
|
147 |
+
add_generation_prompt=True,
|
148 |
+
return_tensors="pt"
|
149 |
+
).to(model.device)
|
150 |
+
|
151 |
+
terminators = [
|
152 |
+
tokenizer.eos_token_id,
|
153 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
154 |
+
]
|
155 |
+
|
156 |
+
outputs = model.generate(
|
157 |
+
input_ids,
|
158 |
+
max_new_tokens=512,
|
159 |
+
eos_token_id=terminators,
|
160 |
+
do_sample=True,
|
161 |
+
temperature=0.4,
|
162 |
+
top_p=0.95,
|
163 |
+
)
|
164 |
+
response = outputs[0][input_ids.shape[-1]:]
|
165 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
166 |
+
```
|
167 |
+
|
168 |
+
## **Chat Template**
|
169 |
+
|
170 |
+
We use the Llama 3 chat template.
|
171 |
+
|
172 |
+
```python
|
173 |
+
{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}{% endif %}
|
174 |
+
```
|
175 |
+
|
176 |
+
## **Intended Uses & Limitations**
|
177 |
+
|
178 |
+
This model is experimental and might not be fully evaluated for all use cases. Developers should assess risks in the context of their specific applications.
|
179 |
+
|
180 |
+
## **Follow us**
|
181 |
+
|
182 |
+
[**https://twitter.com/opentyphoon**](https://twitter.com/opentyphoon)
|
183 |
+
|
184 |
+
## **Support**
|
185 |
+
|
186 |
+
[**https://discord.gg/CqyBscMFpg**](https://discord.gg/CqyBscMFpg)
|
187 |
+
|
188 |
+
## **SCB 10X Typhoon Team**
|
189 |
+
|
190 |
+
- Kunat Pipatanakul, Potsawee Manakul, Sittipong Sripaisarnmongkol, Natapong Nitarach, Pathomporn Chokchainant, Kasima Tharnpipitchai
|
191 |
+
- If you find Typhoon-1.5X useful for your work, please cite it using:
|
192 |
+
|
193 |
+
```
|
194 |
+
@article{pipatanakul2023typhoon,
|
195 |
+
title={Typhoon: Thai Large Language Models},
|
196 |
+
author={Kunat Pipatanakul and Phatrasek Jirabovonvisut and Potsawee Manakul and Sittipong Sripaisarnmongkol and Ruangsak Patomwong and Pathomporn Chokchainant and Kasima Tharnpipitchai},
|
197 |
+
year={2023},
|
198 |
+
journal={arXiv preprint arXiv:2312.13951},
|
199 |
+
url={https://arxiv.org/abs/2312.13951}
|
200 |
+
}
|
201 |
+
```
|
202 |
+
|
203 |
+
## **Contact Us**
|
204 |
+
|
205 |
+
- General & Collaboration: [**kasima@scb10x.com**](mailto:kasima@scb10x.com), [**pathomporn@scb10x.com**](mailto:pathomporn@scb10x.com)
|
206 |
+
- Technical: [**kunat@scb10x.com**](mailto:kunat@scb10x.com)
|
207 |
+
|