zsytony commited on
Commit
e8217bb
·
1 Parent(s): 52e5bf8

Create README_zh-CN.md

Browse files
Files changed (1) hide show
  1. README_zh-CN.md +279 -0
README_zh-CN.md ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # MixtralKit
4
+
5
+ Mixtral 模型工具箱
6
+
7
+ <br />
8
+ <br />
9
+
10
+ [English](/README.md) | 简体中文
11
+ 进入 [Github](https://github.com/open-compass/MixtralKit) 查看推理和评测教程
12
+
13
+ </div>
14
+
15
+
16
+
17
+
18
+ > 欢迎试用 [OpenCompass](https://github.com/open-compass/opencompass) 进行模型评测,Mixtral模型性能将会很快更新。
19
+
20
+ > 本仓库仅提供实验性质的推理代码,非Mistral AI官方提供的示例代码。
21
+
22
+
23
+ - [性能](#性能)
24
+ - [准备模型权重](#准备模型权重)
25
+ - [下载模型权重](#下载模型权重)
26
+ - [文件拼接](#文件拼接仅hf格式需要)
27
+ - [文件校验](#文件校验)
28
+ - [安装](#安装)
29
+ - [推理](#推理)
30
+ - [文本补全](#文本补全)
31
+ - [使用OpenCompass评测](#使用opencompass评测)
32
+ - [第一步: 配置OpenCompass](#第一步-配置opencompass)
33
+ - [第二步: 准备评测配置文件和数据集](#第二步-准备评测配置文件和数据集)
34
+ - [第三步:执行评测](#第三步执行评测)
35
+ - [致谢](#致谢)
36
+
37
+
38
+ # 性能
39
+
40
+
41
+ - 所有数据来源自[OpenCompass](https://github.com/open-compass/opencompass)
42
+
43
+ > 由于不同评测框架在提示词,评测设定和实现细节上均有所不同,所以请勿直接对比不同框架获得的评测结果。
44
+
45
+ ## 性能对比
46
+
47
+
48
+ | Datasets | Mode | Mistral-7B-v0.1 | Mixtral-8x7B | Llama2-70B | DeepSeek-67B-Base | Qwen-72B |
49
+ |-----------------|------|-----------------|--------------|-------------|-------------------|----------|
50
+ | MMLU | PPL | 64.1 | 71.3 | 69.7 | 71.9 | 77.3 |
51
+ | BIG-Bench-Hard | GEN | 56.7 | 67.1 | 64.9 | 71.7 | 63.7 |
52
+ | GSM-8K | GEN | 47.5 | 65.7 | 63.4 | 66.5 | 77.6 |
53
+ | MATH | GEN | 11.3 | 22.7 | 12.0 | 15.9 | 35.1 |
54
+ | HumanEval | GEN | 27.4 | 32.3 | 26.2 | 40.9 | 33.5 |
55
+ | MBPP | GEN | 38.6 | 47.8 | 39.6 | 55.2 | 51.6 |
56
+ | ARC-c | PPL | 74.2 | 85.1 | 78.3 | 86.8 | 92.2 |
57
+ | ARC-e | PPL | 83.6 | 91.4 | 85.9 | 93.7 | 96.8 |
58
+ | CommonSenseQA | PPL | 67.4 | 70.4 | 78.3 | 70.7 | 73.9 |
59
+ | NaturalQuestion | GEN | 24.6 | 29.4 | 34.2 | 29.9 | 27.1 |
60
+ | TrivialQA | GEN | 56.5 | 66.1 | 70.7 | 67.4 | 60.1 |
61
+ | HellaSwag | PPL | 78.9 | 82.0 | 82.3 | 82.3 | 85.4 |
62
+ | PIQA | PPL | 81.6 | 82.9 | 82.5 | 82.6 | 85.2 |
63
+ | SIQA | GEN | 60.2 | 64.3 | 64.8 | 62.6 | 78.2 |
64
+
65
+
66
+ ## Mixtral-8x7b 性能
67
+
68
+ ```markdown
69
+ dataset version metric mode mixtral-8x7b-32k
70
+ -------------------------------------- --------- ------------- ------ ------------------
71
+ mmlu - naive_average ppl 71.34
72
+ ARC-c 2ef631 accuracy ppl 85.08
73
+ ARC-e 2ef631 accuracy ppl 91.36
74
+ BoolQ 314797 accuracy ppl 86.27
75
+ commonsense_qa 5545e2 accuracy ppl 70.43
76
+ triviaqa 2121ce score gen 66.05
77
+ nq 2121ce score gen 29.36
78
+ openbookqa_fact 6aac9e accuracy ppl 85.40
79
+ AX_b 6db806 accuracy ppl 48.28
80
+ AX_g 66caf3 accuracy ppl 48.60
81
+ hellaswag a6e128 accuracy ppl 82.01
82
+ piqa 0cfff2 accuracy ppl 82.86
83
+ siqa e8d8c5 accuracy ppl 64.28
84
+ math 265cce accuracy gen 22.74
85
+ gsm8k 1d7fe4 accuracy gen 65.66
86
+ openai_humaneval a82cae humaneval_pass@1 gen 32.32
87
+ mbpp 1e1056 score gen 47.80
88
+ bbh - naive_average gen 67.14
89
+ ```
90
+
91
+ # 准备模型权重
92
+
93
+ ## 下载模型权重
94
+
95
+ 你可以通过使用磁力链接(迅雷)或使用HuggingFace进行下载
96
+
97
+ ### HuggingFace
98
+
99
+ 社区用户提供的HF文件切分版:[HuggingFace仓库](https://huggingface.co/someone13574/mixtral-8x7b-32kseqlen)
100
+
101
+ ```bash
102
+ # Download the huggingface
103
+ git lfs install
104
+ git clone https://huggingface.co/someone13574/mixtral-8x7b-32kseqlen
105
+
106
+ ```
107
+ > 用户如果无法访问huggingface, 可以使用[国内镜像](https://hf-mirror.com/someone13574/mixtral-8x7b-32kseqlen)
108
+
109
+ ```bash
110
+ # Download the huggingface
111
+ git lfs install
112
+ git clone https://hf-mirror.com/someone13574/mixtral-8x7b-32kseqlen
113
+ ```
114
+
115
+ ### Magnet Link
116
+
117
+ Please use this link to download the original files
118
+ ```bash
119
+ magnet:?xt=urn:btih:5546272da9065eddeb6fcd7ffddeef5b75be79a7&dn=mixtral-8x7b-32kseqlen&tr=udp%3A%2F%http://2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=http%3A%2F%http://2Ftracker.openbittorrent.com%3A80%2Fannounce
120
+ ```
121
+
122
+ ## 文件拼接(仅HF格式需要)
123
+
124
+ ```bash
125
+ cd mixtral-8x7b-32kseqlen/
126
+
127
+ # Merge the checkpoints
128
+ cat consolidated.00.pth-split0 consolidated.00.pth-split1 consolidated.00.pth-split2 consolidated.00.pth-split3 consolidated.00.pth-split4 consolidated.00.pth-split5 consolidated.00.pth-split6 consolidated.00.pth-split7 consolidated.00.pth-split8 consolidated.00.pth-split9 consolidated.00.pth-split10 > consolidated.00.pth
129
+ ```
130
+
131
+
132
+ ## 文件校验
133
+
134
+ 请在使用文件前,进行md5校验,保证文件在下载过程中并未损坏
135
+ ```bash
136
+ md5sum consolidated.00.pth
137
+ md5sum tokenizer.model
138
+
139
+ # 如果完成校验,可删除slit文件
140
+ rm consolidated.00.pth-split*
141
+ ```
142
+
143
+ 官方校验值
144
+
145
+ ```bash
146
+ ╓────────────────────────────────────────────────────────────────────────────╖
147
+ ║ ║
148
+ ║ ·· md5sum ·· ║
149
+ ║ ║
150
+ ║ 1faa9bc9b20fcfe81fcd4eb7166a79e6 consolidated.00.pth ║
151
+ ║ 37974873eb68a7ab30c4912fc36264ae tokenizer.model ║
152
+ ╙────────────────────────────────────────────────────────────────────────────╜
153
+ ```
154
+
155
+ # 安装
156
+
157
+ ```bash
158
+ git clone https://github.com/open-compass/MixtralKit
159
+ cd MixtralKit/
160
+ pip install -r requirements.txt
161
+ pip install -e .
162
+
163
+ ln -s path/to/checkpoints ckpts
164
+ ```
165
+
166
+ # 推理
167
+
168
+ ## 文本补全
169
+
170
+ ```bash
171
+ ==============================Example START==============================
172
+
173
+ [Prompt]:
174
+ Who are you?
175
+
176
+ [Response]:
177
+ I am a designer and theorist; a lecturer at the University of Malta and a partner in the firm Barbagallo and Baressi Design, which won the prestig
178
+ ious Compasso d’Oro award in 2004. I was educated in industrial and interior design in the United States
179
+
180
+ ==============================Example END==============================
181
+
182
+ ==============================Example START==============================
183
+
184
+ [Prompt]:
185
+ 1 + 1 -> 3
186
+ 2 + 2 -> 5
187
+ 3 + 3 -> 7
188
+ 4 + 4 ->
189
+
190
+ [Response]:
191
+ 9
192
+ 5 + 5 -> 11
193
+ 6 + 6 -> 13
194
+
195
+ #include <iostream>
196
+
197
+ using namespace std;
198
+
199
+ int addNumbers(int x, int y)
200
+ {
201
+ return x + y;
202
+ }
203
+
204
+ int main()
205
+ {
206
+
207
+ ==============================Example END==============================
208
+
209
+ ```
210
+
211
+
212
+ # 使用OpenCompass评测
213
+
214
+ ## 第一步: 配置OpenCompass
215
+
216
+ - 克隆和安装 OpenCompass
217
+
218
+ ```bash
219
+ # assume you have already create the conda env named mixtralkit
220
+ conda activate mixtralkit
221
+
222
+ git clone https://github.com/open-compass/opencompass opencompass
223
+ cd opencompass
224
+
225
+ pip install -e .
226
+ ```
227
+
228
+ - 准备评测数据集
229
+
230
+ ```bash
231
+ # Download dataset to data/ folder
232
+ wget https://github.com/open-compass/opencompass/releases/download/0.1.8.rc1/OpenCompassData-core-20231110.zip
233
+ unzip OpenCompassData-core-20231110.zip
234
+ ```
235
+
236
+ > If you need to evaluate the **humaneval**, please go to [Installation Guide](https://opencompass.readthedocs.io/en/latest/get_started/installation.html) for more information
237
+
238
+
239
+ ## 第二步: 准备评测配置文件和数据集
240
+
241
+ ```bash
242
+ cd opencompass/
243
+ # link the example config into opencompass
244
+ ln -s path/to/MixtralKit/playground playground
245
+
246
+ # link the model weights into opencompass
247
+ mkdir -p ./models/mixtral/
248
+ ln -s path/to/checkpoints_folder/ ./models/mixtral/mixtral-8x7b-32kseqlen
249
+ ```
250
+
251
+ 现在文件结构应该如下所示
252
+
253
+ ```bash
254
+ opencompass/
255
+ ├── configs
256
+ │ ├── .....
257
+ │ └── .....
258
+ ├── models
259
+ │ └── mixtral
260
+ │ └── mixtral-8x7b-32kseqlen
261
+ ├── data/
262
+ ├── playground
263
+ │ └── eval_mixtral.py
264
+ │── ......
265
+ ```
266
+
267
+
268
+ ## 第三步:执行评测
269
+
270
+ ```bash
271
+ HF_EVALUATE_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 python run.py playground/eval_mixtral.py
272
+
273
+ # 请编辑playground/eval_mixtral.py来配置希望评测的数据集
274
+
275
+ ```
276
+
277
+ # 致谢
278
+ - [llama-mistral](https://github.com/dzhulgakov/llama-mistral)
279
+ - [llama](https://github.com/facebookresearch/llama)