haoyang-amd commited on
Commit
f2b5747
·
verified ·
1 Parent(s): 9ca79bc

Update README.md

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