Improve language tag
Browse filesHi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.
README.md
CHANGED
@@ -1,216 +1,228 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
license_link: https://huggingface.co/Qwen/Qwen2.5-7B/blob/main/LICENSE
|
4 |
-
language:
|
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 |
-
Weight quantization
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
from
|
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 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
<
|
149 |
-
</
|
150 |
-
<
|
151 |
-
</
|
152 |
-
<
|
153 |
-
</
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
<td>
|
159 |
-
</td>
|
160 |
-
<td>
|
161 |
-
</td>
|
162 |
-
<td>
|
163 |
-
</td>
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
<td>
|
169 |
-
</td>
|
170 |
-
<td>
|
171 |
-
</td>
|
172 |
-
<td>
|
173 |
-
</td>
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
<td>
|
179 |
-
</td>
|
180 |
-
<td>
|
181 |
-
</td>
|
182 |
-
<td>
|
183 |
-
</td>
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
<td>
|
189 |
-
</td>
|
190 |
-
<td>
|
191 |
-
</td>
|
192 |
-
<td>
|
193 |
-
</td>
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
<td>
|
199 |
-
</td>
|
200 |
-
<td>
|
201 |
-
</td>
|
202 |
-
<td>
|
203 |
-
</td>
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
<td
|
209 |
-
</td>
|
210 |
-
<td
|
211 |
-
</td>
|
212 |
-
<td
|
213 |
-
</td>
|
214 |
-
|
215 |
-
</
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
license_link: https://huggingface.co/Qwen/Qwen2.5-7B/blob/main/LICENSE
|
4 |
+
language:
|
5 |
+
- zho
|
6 |
+
- eng
|
7 |
+
- fra
|
8 |
+
- spa
|
9 |
+
- por
|
10 |
+
- deu
|
11 |
+
- ita
|
12 |
+
- rus
|
13 |
+
- jpn
|
14 |
+
- kor
|
15 |
+
- vie
|
16 |
+
- tha
|
17 |
+
- ara
|
18 |
+
pipeline_tag: text-generation
|
19 |
+
base_model: Qwen/Qwen2.5-7B-Instruct
|
20 |
+
tags:
|
21 |
+
- chat
|
22 |
+
- neuralmagic
|
23 |
+
- llmcompressor
|
24 |
+
- fp8
|
25 |
+
---
|
26 |
+
|
27 |
+
# Qwen2.5-7B-Instruct-FP8-dynamic
|
28 |
+
|
29 |
+
## Model Overview
|
30 |
+
- **Model Architecture:** Qwen2
|
31 |
+
- **Input:** Text
|
32 |
+
- **Output:** Text
|
33 |
+
- **Model Optimizations:**
|
34 |
+
- **Activation quantization:** FP8
|
35 |
+
- **Weight quantization:** FP8
|
36 |
+
- **Intended Use Cases:** Intended for commercial and research use multiple languages. Similarly to [Qwen2.5-7B](https://huggingface.co/Qwen/Qwen2.5-7B), this models is intended for assistant-like chat.
|
37 |
+
- **Out-of-scope:** Use in any manner that violates applicable laws or regulations (including trade compliance laws).
|
38 |
+
- **Release Date:** 11/27/2024
|
39 |
+
- **Version:** 1.0
|
40 |
+
- **License(s):** [apache-2.0](https://huggingface.co/Qwen/Qwen2.5-7B/blob/main/LICENSE)
|
41 |
+
- **Model Developers:** Neural Magic
|
42 |
+
|
43 |
+
### Model Optimizations
|
44 |
+
|
45 |
+
This model was obtained by quantizing activations and weights of [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) to FP8 data type.
|
46 |
+
This optimization reduces the number of bits used to represent weights and activations from 16 to 8, reducing GPU memory requirements (by approximately 50%) and increasing matrix-multiply compute throughput (by approximately 2x).
|
47 |
+
Weight quantization also reduces disk size requirements by approximately 50%.
|
48 |
+
|
49 |
+
Only weights and activations of the linear operators within transformers blocks are quantized.
|
50 |
+
Weights are quantized with a symmetric static per-channel scheme, whereas activations are quantized with a symmetric dynamic per-token scheme.
|
51 |
+
The [llm-compressor](https://github.com/vllm-project/llm-compressor) library is used for quantization.
|
52 |
+
|
53 |
+
## Deployment
|
54 |
+
|
55 |
+
This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
|
56 |
+
|
57 |
+
```python
|
58 |
+
from vllm import LLM, SamplingParams
|
59 |
+
from transformers import AutoTokenizer
|
60 |
+
|
61 |
+
model_id = "RedHatAI/Qwen2.5-7B-Instruct-FP8-dynamic"
|
62 |
+
number_gpus = 1
|
63 |
+
max_model_len = 8192
|
64 |
+
|
65 |
+
sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
|
66 |
+
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
68 |
+
|
69 |
+
messages = [
|
70 |
+
{"role": "user", "content": "Give me a short introduction to large language model."},
|
71 |
+
]
|
72 |
+
|
73 |
+
prompts = tokenizer.apply_chat_template(messages, tokenize=False)
|
74 |
+
|
75 |
+
llm = LLM(model=model_id, tensor_parallel_size=number_gpus, max_model_len=max_model_len)
|
76 |
+
|
77 |
+
outputs = llm.generate(prompts, sampling_params)
|
78 |
+
|
79 |
+
generated_text = outputs[0].outputs[0].text
|
80 |
+
print(generated_text)
|
81 |
+
```
|
82 |
+
|
83 |
+
vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
|
84 |
+
|
85 |
+
## Creation
|
86 |
+
|
87 |
+
<details>
|
88 |
+
<summary>Creation details</summary>
|
89 |
+
This model was created with [llm-compressor](https://github.com/vllm-project/llm-compressor) by running the code snippet below.
|
90 |
+
|
91 |
+
|
92 |
+
```python
|
93 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
94 |
+
from llmcompressor.modifiers.quantization import QuantizationModifier
|
95 |
+
from llmcompressor.transformers import oneshot
|
96 |
+
|
97 |
+
# Load model
|
98 |
+
model_stub = "Qwen/Qwen2.5-7B-Instruct-FP8-dynamic"
|
99 |
+
model_name = model_stub.split("/")[-1]
|
100 |
+
|
101 |
+
tokenizer = AutoTokenizer.from_pretrained(model_stub)
|
102 |
+
|
103 |
+
model = AutoModelForCausalLM.from_pretrained(
|
104 |
+
model_stub,
|
105 |
+
device_map="auto",
|
106 |
+
torch_dtype="auto",
|
107 |
+
)
|
108 |
+
|
109 |
+
# Configure the quantization algorithm and scheme
|
110 |
+
recipe = QuantizationModifier(
|
111 |
+
targets="Linear",
|
112 |
+
scheme="FP8_dynamic",
|
113 |
+
ignore=["lm_head"],
|
114 |
+
)
|
115 |
+
|
116 |
+
# Apply quantization
|
117 |
+
oneshot(
|
118 |
+
model=model,
|
119 |
+
recipe=recipe,
|
120 |
+
)
|
121 |
+
|
122 |
+
# Save to disk in compressed-tensors format
|
123 |
+
save_path = model_name + "-FP8-dynamic"
|
124 |
+
model.save_pretrained(save_path)
|
125 |
+
tokenizer.save_pretrained(save_path)
|
126 |
+
print(f"Model and tokenizer saved to: {save_path}")
|
127 |
+
```
|
128 |
+
</details>
|
129 |
+
|
130 |
+
## Evaluation
|
131 |
+
|
132 |
+
The model was evaluated on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) leaderboard tasks (version 1) with the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness/tree/387Bbd54bc621086e05aa1b030d8d4d5635b25e6) (commit 387Bbd54bc621086e05aa1b030d8d4d5635b25e6) and the [vLLM](https://docs.vllm.ai/en/stable/) engine, using the following command:
|
133 |
+
```
|
134 |
+
lm_eval \
|
135 |
+
--model vllm \
|
136 |
+
--model_args pretrained="neuralmagic/Qwen2.5-7B-Instruct-FP8-dynamic",dtype=auto,gpu_memory_utilization=0.5,max_model_len=4096,enable_chunk_prefill=True,tensor_parallel_size=1 \
|
137 |
+
--apply_chat_template \
|
138 |
+
--fewshot_as_multiturn \
|
139 |
+
--tasks openllm \
|
140 |
+
--batch_size auto
|
141 |
+
```
|
142 |
+
|
143 |
+
### Accuracy
|
144 |
+
|
145 |
+
#### Open LLM Leaderboard evaluation scores
|
146 |
+
<table>
|
147 |
+
<tr>
|
148 |
+
<th>Benchmark
|
149 |
+
</th>
|
150 |
+
<th>Qwen2.5-7B-Instruct
|
151 |
+
</th>
|
152 |
+
<th>Qwen2.5-7B-Instruct-FP8-dynamic<br>(this model)
|
153 |
+
</th>
|
154 |
+
<th>Recovery
|
155 |
+
</th>
|
156 |
+
</tr>
|
157 |
+
<tr>
|
158 |
+
<td>MMLU (5-shot)
|
159 |
+
</td>
|
160 |
+
<td>74.24
|
161 |
+
</td>
|
162 |
+
<td>74.04
|
163 |
+
</td>
|
164 |
+
<td>99.7%
|
165 |
+
</td>
|
166 |
+
</tr>
|
167 |
+
<tr>
|
168 |
+
<td>ARC Challenge (25-shot)
|
169 |
+
</td>
|
170 |
+
<td>63.40
|
171 |
+
</td>
|
172 |
+
<td>63.14
|
173 |
+
</td>
|
174 |
+
<td>99.6%
|
175 |
+
</td>
|
176 |
+
</tr>
|
177 |
+
<tr>
|
178 |
+
<td>GSM-8K (5-shot, strict-match)
|
179 |
+
</td>
|
180 |
+
<td>80.36
|
181 |
+
</td>
|
182 |
+
<td>80.06
|
183 |
+
</td>
|
184 |
+
<td>99.6%
|
185 |
+
</td>
|
186 |
+
</tr>
|
187 |
+
<tr>
|
188 |
+
<td>Hellaswag (10-shot)
|
189 |
+
</td>
|
190 |
+
<td>81.52
|
191 |
+
</td>
|
192 |
+
<td>81.11
|
193 |
+
</td>
|
194 |
+
<td>99.5%
|
195 |
+
</td>
|
196 |
+
</tr>
|
197 |
+
<tr>
|
198 |
+
<td>Winogrande (5-shot)
|
199 |
+
</td>
|
200 |
+
<td>74.66
|
201 |
+
</td>
|
202 |
+
<td>74.43
|
203 |
+
</td>
|
204 |
+
<td>99.7%
|
205 |
+
</td>
|
206 |
+
</tr>
|
207 |
+
<tr>
|
208 |
+
<td>TruthfulQA (0-shot, mc2)
|
209 |
+
</td>
|
210 |
+
<td>64.76
|
211 |
+
</td>
|
212 |
+
<td>64.87
|
213 |
+
</td>
|
214 |
+
<td>100.2%
|
215 |
+
</td>
|
216 |
+
</tr>
|
217 |
+
<tr>
|
218 |
+
<td><strong>Average</strong>
|
219 |
+
</td>
|
220 |
+
<td><strong>73.16</strong>
|
221 |
+
</td>
|
222 |
+
<td><strong>72.94</strong>
|
223 |
+
</td>
|
224 |
+
<td><strong>99.7%</strong>
|
225 |
+
</td>
|
226 |
+
</tr>
|
227 |
+
</table>
|
228 |
+
|