gamepollakrit
commited on
Commit
•
1b928ee
1
Parent(s):
4b21efe
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- th
|
4 |
+
- en
|
5 |
+
license: apache-2.0
|
6 |
+
library_name: transformers
|
7 |
+
base_model:
|
8 |
+
- Qwen/Qwen2.5-7B-Instruct
|
9 |
+
- Qwen/Qwen2.5-7B
|
10 |
+
pipeline_tag: text-generation
|
11 |
+
---
|
12 |
+
<img src="./Tsunami.webp" alt="Tsunami Model" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
13 |
+
|
14 |
+
# Tsunami-1.0-7B-Instruct
|
15 |
+
**TSUNAMI**: Transformative Semantic Understanding and Natural Augmentation Model for Intelligence.
|
16 |
+
|
17 |
+
**TSUNAMI** full name was created by ChatGPT.
|
18 |
+
|
19 |
+
---
|
20 |
+
|
21 |
+
### infomation
|
22 |
+
**Tsunami-1.0-7B-Instruct** is Thai Large Language Model that fine-tuned from **Qwen2.5-7B** in Thai dataset.
|
23 |
+
|
24 |
+
---
|
25 |
+
|
26 |
+
### Author
|
27 |
+
- Pollakrit Lorprasertkul | [email protected]
|
28 |
+
|
29 |
+
---
|
30 |
+
|
31 |
+
### Prompt Template
|
32 |
+
|
33 |
+
This model uses `ChatML` prompt template:
|
34 |
+
|
35 |
+
```
|
36 |
+
<|im_start|>system
|
37 |
+
{System}<|im_end|>
|
38 |
+
<|im_start|>user
|
39 |
+
{User}<|im_end|>
|
40 |
+
<|im_start|>assistant
|
41 |
+
{Assistant}
|
42 |
+
````
|
43 |
+
|
44 |
+
---
|
45 |
+
|
46 |
+
### How to use
|
47 |
+
|
48 |
+
|
49 |
+
```python
|
50 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
51 |
+
import torch
|
52 |
+
model_name = "Tsunami-th/Tsunami-1.0-7B-Instruct"
|
53 |
+
model = AutoModelForCausalLM.from_pretrained(
|
54 |
+
model_name,
|
55 |
+
torch_dtype="auto",
|
56 |
+
device_map="auto"
|
57 |
+
)
|
58 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
59 |
+
messages = [
|
60 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
61 |
+
{"role": "user", "content": "สวัสดีครับ"}
|
62 |
+
]
|
63 |
+
text = tokenizer.apply_chat_template(
|
64 |
+
messages,
|
65 |
+
tokenize=False,
|
66 |
+
add_generation_prompt=True
|
67 |
+
)
|
68 |
+
inputs = tokenizer(text, return_tensors="pt")
|
69 |
+
inputs = inputs.to(model.device)
|
70 |
+
with torch.no_grad():
|
71 |
+
output = model.generate(**inputs, max_new_tokens=512)
|
72 |
+
response = tokenizer.decode(output[0, len(inputs['input_ids'][0]):], skip_special_tokens=True)
|
73 |
+
```
|
74 |
+
|
75 |
+
---
|