Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,76 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
base_model: mistralai/Mixtral-8x7B-Instruct-v0.1
|
4 |
+
---
|
5 |
+
|
6 |
+
|
7 |
+
# Mixtral-8x7B-Instruct-v0.1-FP8-KV
|
8 |
+
- ## Introduction
|
9 |
+
This model was created by applying [Quark](https://quark.docs.amd.com/latest/index.html) with calibration samples from Pile dataset.
|
10 |
+
- ## Quantization Stragegy
|
11 |
+
- ***Quantized Layers***: All linear layers excluding "lm_head", "*gate"
|
12 |
+
- ***Weight***: FP8 symmetric per-tensor
|
13 |
+
- ***Activation***: FP8 symmetric per-tensor
|
14 |
+
- ***KV Cache***: FP8 symmetric per-tensor
|
15 |
+
- ## Quick Start
|
16 |
+
1. [Download and install Quark](https://quark.docs.amd.com/latest/install.html)
|
17 |
+
2. Run the quantization script in the example folder using the following command line:
|
18 |
+
```sh
|
19 |
+
export MODEL_DIR = [local model checkpoint folder] or mistralai/Mixtral-8x7B-Instruct-v0.1
|
20 |
+
# single GPU
|
21 |
+
python3 quantize_quark.py \
|
22 |
+
--model_dir $MODEL_DIR \
|
23 |
+
--output_dir Mixtral-8x7B-Instruct-v0.1-FP8-KV \
|
24 |
+
--quant_scheme w_fp8_a_fp8 \
|
25 |
+
--kv_cache_dtype fp8 \
|
26 |
+
--num_calib_data 128 \
|
27 |
+
--model_export quark_safetensors
|
28 |
+
# If model size is too large for single GPU, please use multi GPU instead.
|
29 |
+
python3 quantize_quark.py \
|
30 |
+
--model_dir $MODEL_DIR \
|
31 |
+
--output_dir Mixtral-8x7B-Instruct-v0.1-FP8-KV \
|
32 |
+
--quant_scheme w_fp8_a_fp8 \
|
33 |
+
--kv_cache_dtype fp8 \
|
34 |
+
--num_calib_data 128 \
|
35 |
+
--model_export quark_safetensors \
|
36 |
+
--multi_gpu
|
37 |
+
```
|
38 |
+
## Deployment
|
39 |
+
Quark has its own export format and allows FP8 quantized models to be efficiently deployed using the vLLM backend(vLLM-compatible).
|
40 |
+
## Evaluation
|
41 |
+
Quark currently uses perplexity(PPL) as the evaluation metric for accuracy loss before and after quantization.The specific PPL algorithm can be referenced in the quantize_quark.py.
|
42 |
+
The quantization evaluation results are conducted in pseudo-quantization mode, which may slightly differ from the actual quantized inference accuracy. These results are provided for reference only.
|
43 |
+
#### Evaluation scores
|
44 |
+
<table>
|
45 |
+
<tr>
|
46 |
+
<td><strong>Benchmark</strong>
|
47 |
+
</td>
|
48 |
+
<td><strong>Mixtral-8x7B-Instruct-v0.1 </strong>
|
49 |
+
</td>
|
50 |
+
<td><strong>Mixtral-8x7B-Instruct-v0.1-FP8-KV(this model)</strong>
|
51 |
+
</td>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td>Perplexity-wikitext2
|
55 |
+
</td>
|
56 |
+
<td>4.1391
|
57 |
+
</td>
|
58 |
+
<td>4.2187
|
59 |
+
</td>
|
60 |
+
</tr>
|
61 |
+
</table>
|
62 |
+
|
63 |
+
#### License
|
64 |
+
Copyright (c) 2018-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
65 |
+
|
66 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
67 |
+
you may not use this file except in compliance with the License.
|
68 |
+
You may obtain a copy of the License at
|
69 |
+
|
70 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
71 |
+
|
72 |
+
Unless required by applicable law or agreed to in writing, software
|
73 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
74 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
75 |
+
See the License for the specific language governing permissions and
|
76 |
+
limitations under the License.
|