Update README.md
Browse files
README.md
CHANGED
@@ -8,14 +8,16 @@ language:
|
|
8 |
|
9 |
# Model Card for Breeze-7B-Base-v1_0
|
10 |
|
11 |
-
Breeze-7B is a language model family that builds on top of [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-
|
12 |
|
13 |
[Breeze-7B-Base](https://huggingface.co/MediaTek-Research/Breeze-7B-Base-v1_0) is the base model for the Breeze-7B series.
|
14 |
It is suitable for use if you have substantial fine-tuning data to tune it for your specific use case.
|
15 |
|
16 |
[Breeze-7B-Instruct](https://huggingface.co/MediaTek-Research/Breeze-7B-Instruct-v1_0) derives from the base model Breeze-7B-Base, making the resulting model amenable to be used as-is for commonly seen tasks.
|
17 |
|
18 |
-
The current release version of Breeze-7B is v1.0.
|
|
|
|
|
19 |
|
20 |
Practicality-wise:
|
21 |
- Breeze-7B-Base expands the original vocabulary with an additional 30,000 Traditional Chinese tokens. With the expanded vocabulary, and everything else being equal, Breeze-7B operates at twice the inference speed for Traditional Chinese to Mistral-7B and Llama 7B. [See [Inference Performance](#inference-performance).]
|
@@ -23,14 +25,14 @@ Practicality-wise:
|
|
23 |
|
24 |
|
25 |
Performance-wise:
|
26 |
-
- Breeze-7B-Instruct demonstrates impressive performance in benchmarks for Traditional Chinese and English when compared to similar-sized open-source contemporaries such as Taiwan-LLM-7B/13B-chat, QWen-7B-Chat, and Yi-6B-Chat. [See [Chat Model Performance](#chat-model-performance).]
|
27 |
|
28 |
|
29 |
*A project by the members (in alphabetical order): Chan-Jan Hsu 許湛然, Chang-Le Liu 劉昶樂, Feng-Ting Liao 廖峰挺, Po-Chun Hsu 許博竣, Yi-Chang Chen 陳宜昌, and the supervisor Da-Shan Shiu 許大山.*
|
30 |
|
31 |
## Demo
|
32 |
|
33 |
-
[
|
34 |
|
35 |
## Features
|
36 |
|
@@ -56,33 +58,26 @@ Performance-wise:
|
|
56 |
|
57 |
## Base Model Performance
|
58 |
|
|
|
59 |
**TMMLU+**, **DRCD**, and **Table** source from [MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2).
|
60 |
[MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2) derives from [TCEval-v1](https://github.com/mtkresearch/MR-Models/tree/main/TC-Eval)
|
61 |
and [ikala/tmmluplus](https://huggingface.co/datasets/ikala/tmmluplus). **MMLU** sources from [hails/mmlu_no_train](https://huggingface.co/datasets/hails/mmlu_no_train).
|
62 |
We use the code revised from [EleutherAI/lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) to evaluate **TMMLU+**, **DRCD**, **Table**, and **MMLU**. All choice problems adapt the selection by the log-likelihood.
|
63 |
|
64 |
|
65 |
-
| Models
|
66 |
-
|
67 |
-
|
|
68 |
-
|
|
69 |
-
| [
|
70 |
-
| [
|
71 |
-
| [
|
72 |
-
| [
|
73 |
-
| [Qwen-7B-1.5](https://huggingface.co/01-ai/Qwen/Qwen-7B-1.5)| 7B | 46.28 | | 30.56 | 60.53 |
|
74 |
-
| [**Breeze-7B-Base-v1_0**](https://huggingface.co/MediaTek-Research/Breeze-7B-Base-v1_0) | 7B | 40.72 | 80.61 | 31.99 | 58.65 |
|
75 |
-
| [**Breeze-7B-Base-v0_1**](https://huggingface.co/MediaTek-Research/Breeze-7B-Base-v0_1) | 7B | 40.35 | 81.13 | 28.47 | 61.63 |
|
76 |
-
| [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)| 7B | 36.93 | 79.27 | 27.78 | 64.89 |
|
77 |
-
| [Mistral-7B-v0.2](https://huggingface.co/mistralai/Mistral-7B-v0.2)| 7B | 34.94 | | 33.33 | 57.33 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
\* Few-shot learning cannot effectively guide the model to generate the proper answer.
|
82 |
-
\* Gemma's score reference can be found in Maxime Labonne's LinkedIn [post](https://www.linkedin.com/posts/maxime-labonne_does-gemma-overfit-the-open-llm-leaderboard-activity-7166220798427402242-lJFm/) discussing potential overfitting on the open LLM leaderboard.
|
83 |
|
84 |
-
##
|
85 |
|
|
|
|
|
86 |
**TMMLU+**, **DRCD**, **Table**, and **MT-Bench-tw** source from [MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2).
|
87 |
[MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2) derives from [TCEval-v1](https://github.com/mtkresearch/MR-Models/tree/main/TC-Eval)
|
88 |
and [ikala/tmmluplus](https://huggingface.co/datasets/ikala/tmmluplus). **MMLU** sources from [hails/mmlu_no_train](https://huggingface.co/datasets/hails/mmlu_no_train).
|
@@ -91,46 +86,40 @@ Performance-wise:
|
|
91 |
We use the code revised from [fastchat llm_judge](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge) (GPT4 as judge) to evaluate **MT-Bench-tw** and **MT-Bench**.
|
92 |
|
93 |
|
94 |
-
| Models
|
95 |
-
|
96 |
-
| | |TC, Chat |TC, Knowledge |TC,
|
97 |
-
| | |0 shot | 0 shot |
|
98 |
-
| [
|
99 |
-
| [
|
100 |
-
| [
|
101 |
-
| [
|
102 |
-
| [
|
103 |
-
| [
|
104 |
-
| [
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
114 |
-
|
115 |
-
|
|
116 |
-
|
|
117 |
-
|
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
122 |
-
| Taiwan-LLM-13B-v2.0-chat | 6.1 | 3.4 | 4.1 | 2.3 | 3.1 | 7.4 | 6.6 | 6.8 | 5.0 |
|
123 |
-
| Taiwan-LLM-7B-v2.1-chat | 5.2 | 2.6 | 2.3 | 1.2 | 3.4 | 6.6 | 5.7 | 6.8 | 4.2 |
|
124 |
-
|
125 |
-
| Details on TMMLU+ (0 shot):<br/>Model | STEM | Social Science | Humanities | Other | ↑ AVG |
|
126 |
|-----------------------------------------------------|--------------|----------------|------------|------------|---------|
|
127 |
-
|
|
128 |
-
|
|
129 |
| Yi-6B-Chat | 37.80 | 51.74 | 45.36 | 44.25 | 44.79 |
|
130 |
-
|
|
131 |
-
|
|
132 |
-
| **Breeze-7B-Instruct-v0_1** | 37.41 | 46.81 | 42.06 | 40.16 | 41.61 |
|
133 |
-
| Qwen-7B-Chat | 35.44 | 46.22 | 38.35 | 40.06 | 40.02 |
|
134 |
| Taiwan-LLM-13B-v2.0-chat | 27.74 | 33.69 | 27.03 | 29.43 | 29.47 |
|
135 |
| Taiwan-LLM-7B-v2.1-chat | 25.58 | 31.76 | 27.36 | 27.61 | 28.08 |
|
136 |
|
@@ -140,21 +129,18 @@ Performance-wise:
|
|
140 |
In this test, we use the first 700 characters of the [web article](https://health.udn.com/health/story/5976/7699252?from=udn_ch1005_main_index) as the input and ask the model to write the same article again.
|
141 |
All inferences run on 2 RTX A6000 GPUs (using `vllm`, with a tensor-parallel size of 2).
|
142 |
|
143 |
-
| Models |
|
144 |
|--------------------------------------------------------------------|-------------------|--------------------------|
|
145 |
-
|
|
146 |
-
|
|
147 |
-
|
|
148 |
-
|
|
149 |
-
| Qwen-14B-Chat | 18.89 | 9.8k |
|
150 |
-
| Mistral-7B-v0.1-Instruct | 20.48 | 5.1k |
|
151 |
| Taiwan-LLM-7B-v2.1-chat | 26.26 | 2.2k |
|
152 |
-
|
153 |
-
| Yi-34B-Chat | 43.71 | 4.5k |
|
154 |
|
155 |
-
## Long-context Performance
|
156 |
|
157 |
-
|
|
|
158 |
|
159 |
## Use in Transformers
|
160 |
|
@@ -174,18 +160,18 @@ import torch
|
|
174 |
|
175 |
# Instruction Model
|
176 |
model = AutoModelForCausalLM.from_pretrained(
|
177 |
-
"MediaTek-Research/Breeze-7B-Instruct-
|
178 |
device_map="auto",
|
179 |
torch_dtype=torch.bfloat16,
|
180 |
-
attn_implementation="flash_attention_2" # optional
|
181 |
)
|
182 |
|
183 |
# Basemodel
|
184 |
model = AutoModelForCausalLM.from_pretrained(
|
185 |
-
"MediaTek-Research/Breeze-7B-Base-
|
186 |
device_map="auto",
|
187 |
torch_dtype=torch.bfloat16,
|
188 |
-
attn_implementation="flash_attention_2" # optional
|
189 |
)
|
190 |
```
|
191 |
|
@@ -204,22 +190,36 @@ We also integrate `chat_template` into [tokenizer_config.json](tokenizer_config.
|
|
204 |
|
205 |
```python
|
206 |
>>> from transformers import AutoTokenizer
|
207 |
-
>>> tokenizer = AutoTokenizer.from_pretrained("MediaTek-Research/Breeze-7B-Instruct-
|
208 |
>>> chat = [
|
209 |
... {"role": "user", "content": "你好,請問你可以完成什麼任務?"},
|
210 |
... {"role": "assistant", "content": "你好,我可以幫助您解決各種問題、提供資訊和協助您完成許多不同的任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。"},
|
211 |
... {"role": "user", "content": "太棒了!"},
|
212 |
... ]
|
213 |
>>> tokenizer.apply_chat_template(chat, tokenize=False)
|
214 |
-
"<s>You are a helpful AI assistant built by MediaTek Research. The user you are helping speaks Traditional Chinese and comes from Taiwan.
|
215 |
# Tokenized results
|
216 |
# ['▁', '你好', ',', '請問', '你', '可以', '完成', '什麼', '任務', '?']
|
217 |
# ['▁', '你好', ',', '我', '可以', '幫助', '您', '解決', '各種', '問題', '、', '提供', '資訊', '和', '協助', '您', '完成', '許多', '不同', '的', '任務', '。', '例如', ':', '回答', '技術', '問題', '、', '提供', '建議', '、', '翻譯', '文字', '、', '尋找', '資料', '或', '協助', '您', '安排', '行程', '等', '。', '請', '告訴', '我', '如何', '能', '幫助', '您', '。']
|
218 |
# ['▁', '太', '棒', '了', '!']
|
|
|
|
|
|
|
|
|
219 |
```
|
220 |
|
221 |
## Citation
|
222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
```
|
224 |
@article{MediaTek-Research2024breeze7b,
|
225 |
title={Breeze-7B Technical Report},
|
|
|
8 |
|
9 |
# Model Card for Breeze-7B-Base-v1_0
|
10 |
|
11 |
+
MediaTek Research Breeze-7B (hereinafter referred to as Breeze-7B) is a language model family that builds on top of [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1), specifically intended for Traditional Chinese use.
|
12 |
|
13 |
[Breeze-7B-Base](https://huggingface.co/MediaTek-Research/Breeze-7B-Base-v1_0) is the base model for the Breeze-7B series.
|
14 |
It is suitable for use if you have substantial fine-tuning data to tune it for your specific use case.
|
15 |
|
16 |
[Breeze-7B-Instruct](https://huggingface.co/MediaTek-Research/Breeze-7B-Instruct-v1_0) derives from the base model Breeze-7B-Base, making the resulting model amenable to be used as-is for commonly seen tasks.
|
17 |
|
18 |
+
The current release version of Breeze-7B is v1.0, which has undergone a more refined training process compared to Breeze-7B-v0_1, resulting in significantly improved performance in both English and Traditional Chinese.
|
19 |
+
|
20 |
+
For details of this model please read our [paper](https://arxiv.org/abs/2403.02712).
|
21 |
|
22 |
Practicality-wise:
|
23 |
- Breeze-7B-Base expands the original vocabulary with an additional 30,000 Traditional Chinese tokens. With the expanded vocabulary, and everything else being equal, Breeze-7B operates at twice the inference speed for Traditional Chinese to Mistral-7B and Llama 7B. [See [Inference Performance](#inference-performance).]
|
|
|
25 |
|
26 |
|
27 |
Performance-wise:
|
28 |
+
- Breeze-7B-Instruct demonstrates impressive performance in benchmarks for Traditional Chinese and English when compared to similar-sized open-source contemporaries such as Taiwan-LLM-7B/13B-chat, QWen(1.5)-7B-Chat, and Yi-6B-Chat. [See [Chat Model Performance](#chat-model-performance).]
|
29 |
|
30 |
|
31 |
*A project by the members (in alphabetical order): Chan-Jan Hsu 許湛然, Chang-Le Liu 劉昶樂, Feng-Ting Liao 廖峰挺, Po-Chun Hsu 許博竣, Yi-Chang Chen 陳宜昌, and the supervisor Da-Shan Shiu 許大山.*
|
32 |
|
33 |
## Demo
|
34 |
|
35 |
+
[Try Demo Here](https://huggingface.co/spaces/MediaTek-Research/Demo_Breeze-7B-Instruct-v1.0)
|
36 |
|
37 |
## Features
|
38 |
|
|
|
58 |
|
59 |
## Base Model Performance
|
60 |
|
61 |
+
Here we compare Breeze-7B-Base-v1_0 with other open-source base language models of similar parameter size that are widely recognized for their good performance in Chinese.
|
62 |
**TMMLU+**, **DRCD**, and **Table** source from [MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2).
|
63 |
[MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2) derives from [TCEval-v1](https://github.com/mtkresearch/MR-Models/tree/main/TC-Eval)
|
64 |
and [ikala/tmmluplus](https://huggingface.co/datasets/ikala/tmmluplus). **MMLU** sources from [hails/mmlu_no_train](https://huggingface.co/datasets/hails/mmlu_no_train).
|
65 |
We use the code revised from [EleutherAI/lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) to evaluate **TMMLU+**, **DRCD**, **Table**, and **MMLU**. All choice problems adapt the selection by the log-likelihood.
|
66 |
|
67 |
|
68 |
+
| Models | #Parameters | TMMLU+ (ACC) | DRCD (EM) | Table (ACC) | MMLU (ACC) |
|
69 |
+
|---------------------------------------------- |--------|--------------|-------------|-------------|------------|
|
70 |
+
| | |TC, Knowledge |TC, Reasoning|TC, Reasoning|EN, Knowledge|
|
71 |
+
| | | 5 shot | 3 shot | 5 shot | 5 shot |
|
72 |
+
| [**Breeze-7B-Base-v1_0**](https://huggingface.co/MediaTek-Research/Breeze-7B-Base-v1_0) | 7B | 42.67 | 80.61 | 31.99 | 61.24 |
|
73 |
+
| [Yi-6B](https://huggingface.co/01-ai/Yi-6B) | 6B | 49.63 | 76.61 | 34.72 | 65.35 |
|
74 |
+
| [Qwen1.5-7B](https://huggingface.co/Qwen/Qwen1.5-7B) | 7B | 46.59 | 74.41 | 30.56 | 63.07 |
|
75 |
+
| [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) | 7B | 36.93 | 79.27 | 27.78 | 64.89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
## Instruction-tuned Model Performance
|
78 |
|
79 |
+
Here we compare Breeze-7B-Instruct-v1_0 with other open-source instruction-tuned language models of similar parameter size that are widely recognized for their good performance in Chinese.
|
80 |
+
Also, we listed the benchmark scores of GPT-3.5 Turbo (1106), which represents one of the most widely used high-quality cloud language model API services, for reference.
|
81 |
**TMMLU+**, **DRCD**, **Table**, and **MT-Bench-tw** source from [MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2).
|
82 |
[MediaTek-Research/TCEval-v2](https://huggingface.co/datasets/MediaTek-Research/TCEval-v2) derives from [TCEval-v1](https://github.com/mtkresearch/MR-Models/tree/main/TC-Eval)
|
83 |
and [ikala/tmmluplus](https://huggingface.co/datasets/ikala/tmmluplus). **MMLU** sources from [hails/mmlu_no_train](https://huggingface.co/datasets/hails/mmlu_no_train).
|
|
|
86 |
We use the code revised from [fastchat llm_judge](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge) (GPT4 as judge) to evaluate **MT-Bench-tw** and **MT-Bench**.
|
87 |
|
88 |
|
89 |
+
| Models | #Parameters | MT-Bench-tw (Score)| TMMLU+ (ACC) | Table (ACC) | MT-Bench (Score) | MMLU (ACC) |
|
90 |
+
|---------------------------------------------------------------------------------------------------------|--------|--------------------|--------------|-------------|------------------|-------------|
|
91 |
+
| | |TC, Chat |TC, Knowledge |TC, Reasoning|EN, Chat |EN, Knowledge|
|
92 |
+
| | |0 shot | 0 shot | 0 shot |0 shot | 0 shot |
|
93 |
+
| [**Breeze-7B-Instruct-v1_0**](https://huggingface.co/MediaTek-Research/Breeze-7B-Instruct-v1_0) | 7B |6.0 | 42.67 | 39.58 |7.4 | 61.73 |
|
94 |
+
| [GPT-3.5-Turbo](https://openai.com) | |7.1 | 43.56 | 45.14 |7.9 | 67.09 |
|
95 |
+
| [Qwen1.5-7B-Chat](https://huggingface.co/Qwen/Qwen1.5-7B-Chat) | 7B |6.4 | 45.65 | 34.72 |7.6 | 61.85 |
|
96 |
+
| [Mistral-7B-v0.2-Instruct](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) | 7B |5.6 | 34.95 | 33.33 |7.6 | 59.97 |
|
97 |
+
| [Yi-6B-Chat](https://huggingface.co/01-ai/Yi-6B-Chat) | 6B |5.0 | 44.79 | 25.69 |6.0 | 59.45 |
|
98 |
+
| [Taiwan-LLM-13B-v2.0-chat](https://huggingface.co/yentinglin/Taiwan-LLM-13B-v2.0-chat) | 13B |5.0 | 29.47 | 23.61 |N/A* | 50.50 |
|
99 |
+
| [Taiwan-LLM-7B-v2.1-chat](https://huggingface.co/yentinglin/Taiwan-LLM-7B-v2.1-chat) | 7B |4.2 | 28.08 | 31.25 |N/A* | 42.72 |
|
100 |
+
|
101 |
+
\* Taiwan-LLM models respond to multi-turn questions (English) in Traditional Chinese.
|
102 |
+
|
103 |
+
|
104 |
+
| Details on MT-Bench-tw (0 shot):<br/>Models | STEM |Extraction|Reasoning| Math | Coding | Roleplay| Writing |Humanities| AVG |
|
105 |
+
|-----------------------------------------------------|---------|---------|---------|---------|---------|---------|---------|----------| --------- |
|
106 |
+
| **Breeze-7B-Instruct-v1_0** | 7.8 | 5.2 | 4.2 | 4.2 | 4.1 | 7.6 | 5.9 | 9.1 | 6.0 |
|
107 |
+
| GPT-3.5-Turbo | 7.8 | 6.1 | 5.1 | 6.4 | 6.2 | 8.7 | 7.4 | 9.3 | 7.1 |
|
108 |
+
| Qwen1.5-7B-Chat | 9 | 5.6 | 4.7 | 2.8 | 3.7 | 8.0 | 8.0 | 9.4 | 6.4 |
|
109 |
+
| Mistral-7B-v0.2-Instruct | 6.9 | 4.6 | 4.3 | 3.3 | 4.4 | 7.2 | 6.2 | 7.8 | 5.6 |
|
110 |
+
| Yi-6B-Chat | 7.3 | 2.7 | 3.1 | 3.3 | 2.3 | 7.2 | 5.2 | 8.8 | 5.0 |
|
111 |
+
| Taiwan-LLM-13B-v2.0-chat | 6.1 | 3.4 | 4.1 | 2.3 | 3.1 | 7.4 | 6.6 | 6.8 | 5.0 |
|
112 |
+
| Taiwan-LLM-7B-v2.1-chat | 5.2 | 2.6 | 2.3 | 1.2 | 3.4 | 6.6 | 5.7 | 6.8 | 4.2 |
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
+
| Details on TMMLU+ (0 shot):<br/>Model | STEM | Social Science | Humanities | Other | AVG |
|
|
|
|
|
|
|
|
|
117 |
|-----------------------------------------------------|--------------|----------------|------------|------------|---------|
|
118 |
+
| **Breeze-7B-Instruct-v1_0** | 36.46 | 48.38 | 45.11 | 40.75 | 42.67 |
|
119 |
+
| Mistral-7B-v0.2-Instruct | 32.79 | 38.05 | 34.89 | 34.04 | 34.94 |
|
120 |
| Yi-6B-Chat | 37.80 | 51.74 | 45.36 | 44.25 | 44.79 |
|
121 |
+
| GPT-3.5-Turbo | 41.58 | 48.52 | 40.96 | 43.18 | 43.56 |
|
122 |
+
| Qwen1.5-7B-Chat | 41.48 | 51.66 | 44.05 | 45.40 | 45.65 |
|
|
|
|
|
123 |
| Taiwan-LLM-13B-v2.0-chat | 27.74 | 33.69 | 27.03 | 29.43 | 29.47 |
|
124 |
| Taiwan-LLM-7B-v2.1-chat | 25.58 | 31.76 | 27.36 | 27.61 | 28.08 |
|
125 |
|
|
|
129 |
In this test, we use the first 700 characters of the [web article](https://health.udn.com/health/story/5976/7699252?from=udn_ch1005_main_index) as the input and ask the model to write the same article again.
|
130 |
All inferences run on 2 RTX A6000 GPUs (using `vllm`, with a tensor-parallel size of 2).
|
131 |
|
132 |
+
| Models | Inference Time (sec)|Estimated Max Input Length (Char)|
|
133 |
|--------------------------------------------------------------------|-------------------|--------------------------|
|
134 |
+
| **Breeze-7B-Instruct-v1_0** | 10.74 | 11.1k |
|
135 |
+
| Qwen1.5-7B-Chat | 9.35 | 38.9k |
|
136 |
+
| Yi-6B-Chat | 10.62 | 5.2k |
|
137 |
+
| Mistral-7B-Instruct-v0.2 | 20.48 | 5.1k |
|
|
|
|
|
138 |
| Taiwan-LLM-7B-v2.1-chat | 26.26 | 2.2k |
|
139 |
+
<!---| Taiwan-LLM-13B-v2.0-chat | 36.80 | 2.2k |--->
|
|
|
140 |
|
|
|
141 |
|
142 |
+
<!---## Long-context Performance
|
143 |
+
TBD--->
|
144 |
|
145 |
## Use in Transformers
|
146 |
|
|
|
160 |
|
161 |
# Instruction Model
|
162 |
model = AutoModelForCausalLM.from_pretrained(
|
163 |
+
"MediaTek-Research/Breeze-7B-Instruct-v1_0",
|
164 |
device_map="auto",
|
165 |
torch_dtype=torch.bfloat16,
|
166 |
+
# attn_implementation="flash_attention_2" # optional
|
167 |
)
|
168 |
|
169 |
# Basemodel
|
170 |
model = AutoModelForCausalLM.from_pretrained(
|
171 |
+
"MediaTek-Research/Breeze-7B-Base-v1_0",
|
172 |
device_map="auto",
|
173 |
torch_dtype=torch.bfloat16,
|
174 |
+
# attn_implementation="flash_attention_2" # optional
|
175 |
)
|
176 |
```
|
177 |
|
|
|
190 |
|
191 |
```python
|
192 |
>>> from transformers import AutoTokenizer
|
193 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("MediaTek-Research/Breeze-7B-Instruct-v1_0")
|
194 |
>>> chat = [
|
195 |
... {"role": "user", "content": "你好,請問你可以完成什麼任務?"},
|
196 |
... {"role": "assistant", "content": "你好,我可以幫助您解決各種問題、提供資訊和協助您完成許多不同的任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。"},
|
197 |
... {"role": "user", "content": "太棒了!"},
|
198 |
... ]
|
199 |
>>> tokenizer.apply_chat_template(chat, tokenize=False)
|
200 |
+
"<s>You are a helpful AI assistant built by MediaTek Research. The user you are helping speaks Traditional Chinese and comes from Taiwan. [INST] 你好,請問你可以完成什麼任務? [/INST] 你好,我可以幫助您解決各種問題、提供資訊和協助您完成許多不同的任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。 [INST] 太棒了! [/INST] "
|
201 |
# Tokenized results
|
202 |
# ['▁', '你好', ',', '請問', '你', '可以', '完成', '什麼', '任務', '?']
|
203 |
# ['▁', '你好', ',', '我', '可以', '幫助', '您', '解決', '各種', '問題', '、', '提供', '資訊', '和', '協助', '您', '完成', '許多', '不同', '的', '任務', '。', '例如', ':', '回答', '技術', '問題', '、', '提供', '建議', '、', '翻譯', '文字', '、', '尋找', '資料', '或', '協助', '您', '安排', '行程', '等', '。', '請', '告訴', '我', '如何', '能', '幫助', '您', '。']
|
204 |
# ['▁', '太', '棒', '了', '!']
|
205 |
+
|
206 |
+
>>> outputs = model.generate(tokenizer.apply_chat_template(chat, return_tensors="pt"), max_new_tokens=128)
|
207 |
+
>>> print(tokenizer.decode(outputs[0]))
|
208 |
+
|
209 |
```
|
210 |
|
211 |
## Citation
|
212 |
|
213 |
+
<!--
|
214 |
+
```
|
215 |
+
@article{breeze7b2024,
|
216 |
+
title={},
|
217 |
+
author={},
|
218 |
+
journal={arXiv},
|
219 |
+
year={2024}
|
220 |
+
}
|
221 |
+
```
|
222 |
+
--->
|
223 |
```
|
224 |
@article{MediaTek-Research2024breeze7b,
|
225 |
title={Breeze-7B Technical Report},
|