facat commited on
Commit
99a77e8
·
1 Parent(s): 73345b9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +334 -1
README.md CHANGED
@@ -1 +1,334 @@
1
- not currently in use
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ ---
3
+ # 🐷SUS-Chat: Instruction tuning done right
4
+
5
+ <p align="left">
6
+ 中文</a>&nbsp | &nbsp<a href="README.md">English</a>&nbsp
7
+ </p>
8
+
9
+ <br><br>
10
+
11
+ <div align="center">
12
+
13
+ <p align="center">
14
+ <img src="https://github.com/SUSTech-IDEA/SUS-Chat/raw/main/assets/sustech.svg?sanitize=true" width="200px">
15
+ <img src="https://github.com/SUSTech-IDEA/SUS-Chat/raw/main/assets/ccnl.png?sanitize=true" width="200px">
16
+ </p>
17
+
18
+ <div style="display: inline-block;">
19
+
20
+ <a rel="noopener nofollow" href="https://github.com/SUSTech-IDEA/SUS-Chat/issues">
21
+ <img src="https://img.shields.io/github/issues/SUSTech-IDEA/SUS-Chat?logo=github" style="margin: 0 0;">
22
+ </a>
23
+
24
+ </div>
25
+
26
+ <div style="display: inline-block;">
27
+
28
+ <a href="https://huggingface.co/SUSTech">
29
+ <img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-SUSTech-blue" style="margin: 0 0;">
30
+ </a>
31
+
32
+ </div>
33
+
34
+ <div style="display: inline-block;">
35
+
36
+ <a rel="noopener nofollow" href="https://www.modelscope.cn/organization/sustc/">
37
+ <img src="https://img.shields.io/badge/🤖ModelScope-sustc-blue" style="margin: 0 0;">
38
+ </a>
39
+
40
+ </div>
41
+
42
+ <a href="https://wisemodel.cn/organization/SUSTech">
43
+ <img src="https://img.shields.io/badge/WiseModel-SUSTech-blue"> </a>
44
+
45
+ <div style="display: inline-block;">
46
+
47
+ <a rel="noopener nofollow" href="https://github.com/SUSTech-IDEA/SUS-Chat/blob/main/LICENSE">
48
+ <img src="https://img.shields.io/badge/Code_License-Apache_2.0-lightblue" style="margin: 0 0;">
49
+ </a>
50
+
51
+ </div>
52
+
53
+ <div style="display: inline-block;">
54
+
55
+ <a rel="noopener nofollow" href="https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt">
56
+ <img src="https://img.shields.io/badge/Model_License-Model_Agreement-lightblue" style="margin: 0 0;">
57
+ </a>
58
+
59
+ </div>
60
+
61
+ <div style="display: inline-block;">
62
+
63
+ <a rel="noopener nofollow" href="mailto:[email protected]">
64
+ <img src="https://img.shields.io/badge/✉️[email protected]" style="margin: 0 0;">
65
+ </a>
66
+
67
+ </div>
68
+
69
+ </div>
70
+
71
+ # 新闻
72
+
73
+ - 2023-12-06: [SUS-Chat-34B
74
+ chat-ui](https://huggingface.co/spaces/SUSTech/SUS-Chat-34B)
75
+
76
+ - 2023-12-05: SUS-Chat-34B在[Open LLM
77
+ leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)排名第二,并在所有小于70B的模型中排名第一。
78
+
79
+ - 2023-12-01: SUS-Chat-34B现已在HuggingFace🤗上可用。
80
+
81
+ # 模型介绍
82
+
83
+ ![](https://hackmd.io/_uploads/HJlDtzhBa.png)
84
+
85
+ **SUS-Chat-34B**模型是[南方科技大学](https://huggingface.co/SUSTech)联合[IDEA研究院CCNL团队](https://huggingface.co/IDEA-CCNL)开源的通用大模型,
86
+ 2023-12-05在Huggingface的权威榜单上[open_llm_leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)取得了同级别模型最好成绩。
87
+
88
+ SUS-Chat-34B是一个340亿参数规模的双语模型,基于[01-ai/Yi-34B](https://huggingface.co/01-ai/Yi-34B)预训练模型通过数百万高质量、多语言的指令数据进行了微调。
89
+ 在保持基础模型强大的语言能力的同时,SUS-Chat-34B模型通过高质量指令微调改善了模型对人类指令的响应方式,并擅长通过思维链的方式模仿人类思考过程。
90
+ 与[Yi-34B](https://huggingface.co/01-ai/Yi-34B)和[Yi-34B-chat](https://huggingface.co/01-ai/Yi-34B-Chat)相比,它不仅在几乎所有基准测试中提升了性能,而且能够更好地满足了复杂多语言任务的实际需求。
91
+ 在指令微调阶段,我们加入了大量高质量长文本和多轮对话指令数据,将文本窗口从基础模型的4K扩展到8K。
92
+ 这种扩展有助于模型更有效地遵循多轮对话中的指令,显著减少在扩展对话和长文本理解中上下文丢失的问题。为此我们也开发了更高效的训练框架,不久也将进行开源,敬请期待。
93
+
94
+ SUS-Chat-34B模型具有以下亮点:
95
+
96
+ 1. 大规模复杂指令跟随数据:使用1.4B
97
+ token的高质量复杂指令数据进行训练,涵盖中英文、多轮对话、数学、推理等多种指令数据;
98
+ 2. 强大的通用任务性能:SUS-Chat-34B模型在众多主流的中英文任务上表现出色,其效果超越了相同参数规模的其他开源的指令微调模型。即使与更大参数规模的模型相比,SUS-Chat-34B模型也具有不错的竞争力;
99
+ 3. 更长的上下文窗口与出色的多轮对话能力:目前,SUS-Chat-34B原生支持8K的上下文窗口,在大量多轮指令以及单多轮混合数据中进行训练,具有出色的长文本对话信息关注与指令跟随能力。
100
+
101
+ SUS-Chat-34B模型有力地证明了通过正确的指令微调,学术机构可以在不增加模型参数的情况下,通过开源的数据集和模型,获得更好的性能,
102
+ 这弥合了学术界和工业界的在大语言模型上的差距,为学术界和工业界的合作提供了新的可能性。
103
+
104
+ # 模型性能
105
+
106
+ 为了更好地评估SUS-Chat-34B模型的性能,我们在多个基准测试中进行了评估,并开源了评估框架[TLEM](https://huggingface.co/spaces/SUSTech/tlem),以便于其他研究人员进行复现和比较。
107
+
108
+ 在TLEM中,我们使用了多个基准测试,包括:MMLU, CMMLU, C-Eval, BBH,
109
+ GSM-8K, MATH,
110
+ 专注于衡量模型的知识和思维能力,在这些指标中SUS-Chat-34B模型取得了最先进的表现,我们还额外引入了[lm-eval](https://github.com/EleutherAI/lm-evaluation-harness)测试了SUS-Chat和同类模型在winogrande,
111
+ hellaswag, arc, truthful-qa的表现, 衡量模型的常识性推理能力和幻觉。
112
+
113
+ 综合上看,SUS-Chat-34B模型显著领先于同规模的模型,并取得了最先进的综合性能。
114
+ ![](assets/radar.png)
115
+
116
+ 以下是评测结果:
117
+
118
+ <div>
119
+
120
+ <table>
121
+ <colgroup>
122
+ <col style="width: 50%" />
123
+ <col style="width: 50%" />
124
+ </colgroup>
125
+ <tbody>
126
+ <tr class="odd">
127
+ <td style="text-align: center;"><div width="50.0%"
128
+ data-layout-align="center">
129
+ <h2 id="英文能力">英文能力</h2>
130
+ <table>
131
+ <thead>
132
+ <tr class="header">
133
+ <th style="text-align: right;">Model</th>
134
+ <th style="text-align: center;">mmlu (0-shot)</th>
135
+ </tr>
136
+ </thead>
137
+ <tbody>
138
+ <tr class="odd">
139
+ <td style="text-align: right;">GPT-4</td>
140
+ <td style="text-align: center;">83</td>
141
+ </tr>
142
+ <tr class="even">
143
+ <td style="text-align: right;">SUS-Chat-34B</td>
144
+ <td style="text-align: center;"><u>74.35</u></td>
145
+ </tr>
146
+ <tr class="odd">
147
+ <td style="text-align: right;">Qwen-72b-Chat</td>
148
+ <td style="text-align: center;"><strong>74.52</strong></td>
149
+ </tr>
150
+ <tr class="even">
151
+ <td style="text-align: right;">Deepseek-68b-Chat</td>
152
+ <td style="text-align: center;">69.43</td>
153
+ </tr>
154
+ <tr class="odd">
155
+ <td style="text-align: right;">OrionStar-Yi-34B-Chat</td>
156
+ <td style="text-align: center;">68.51</td>
157
+ </tr>
158
+ <tr class="even">
159
+ <td style="text-align: right;">Yi-34B-Chat</td>
160
+ <td style="text-align: center;">66.96</td>
161
+ </tr>
162
+ </tbody>
163
+ </table>
164
+ </div></td>
165
+ <td style="text-align: center;"><div width="50.0%"
166
+ data-layout-align="center">
167
+ <h2 id="中文能力">中文能力</h2>
168
+ <table>
169
+ <colgroup>
170
+ <col style="width: 34%" />
171
+ <col style="width: 32%" />
172
+ <col style="width: 32%" />
173
+ </colgroup>
174
+ <thead>
175
+ <tr class="header">
176
+ <th style="text-align: right;">Model</th>
177
+ <th style="text-align: center;">cmmlu (0-shot)</th>
178
+ <th style="text-align: center;">C-Eval (0-shot)<a href="#fn1"
179
+ class="footnote-ref" id="fnref1"
180
+ role="doc-noteref"><sup>1</sup></a></th>
181
+ </tr>
182
+ </thead>
183
+ <tbody>
184
+ <tr class="odd">
185
+ <td style="text-align: right;">GPT-4</td>
186
+ <td style="text-align: center;">71</td>
187
+ <td style="text-align: center;">69.9</td>
188
+ </tr>
189
+ <tr class="even">
190
+ <td style="text-align: right;">SUS-Chat-34B</td>
191
+ <td style="text-align: center;"><strong>78.68</strong></td>
192
+ <td style="text-align: center;"><strong>82.42</strong></td>
193
+ </tr>
194
+ <tr class="odd">
195
+ <td style="text-align: right;">Qwen-72b-Chat</td>
196
+ <td style="text-align: center;"><u>77.02</u></td>
197
+ <td style="text-align: center;"><u>77.22</u></td>
198
+ </tr>
199
+ <tr class="even">
200
+ <td style="text-align: right;">Deepseek-68b-Chat</td>
201
+ <td style="text-align: center;">48.51</td>
202
+ <td style="text-align: center;">59.7</td>
203
+ </tr>
204
+ <tr class="odd">
205
+ <td style="text-align: right;">OrionStar-Yi-34B-Chat</td>
206
+ <td style="text-align: center;">66.88</td>
207
+ <td style="text-align: center;">65.13</td>
208
+ </tr>
209
+ <tr class="even">
210
+ <td style="text-align: right;">Yi-34B-Chat</td>
211
+ <td style="text-align: center;">55.16</td>
212
+ <td style="text-align: center;">77.16</td>
213
+ </tr>
214
+ </tbody>
215
+ </table>
216
+ </div></td>
217
+ </tr>
218
+ </tbody>
219
+ </table>
220
+ <section id="footnotes" class="footnotes footnotes-end-of-document"
221
+ role="doc-endnotes">
222
+ <hr />
223
+ <ol>
224
+ <li id="fn1"><p>C-Eval 结果在验证集上得到。<a href="#fnref1"
225
+ class="footnote-back" role="doc-backlink">↩︎</a></p></li>
226
+ </ol>
227
+ </section>
228
+
229
+ </div>
230
+
231
+ ## 数学与推理能力
232
+
233
+ 在GSM8K(数学逻辑)的评测都是目前开源模型最强。
234
+
235
+ | Model | gsm8k (0-shot) | MATH (0-shot) | BBH (0-shot) |
236
+ |----------------------:|:--------------:|:-------------:|:------------:|
237
+ | GPT-4 | 91.4 | 45.8 | 86.7 |
238
+ | SUS-Chat-34B | **80.06** | 28.7 | 67.62 |
239
+ | Qwen-72b-Chat | <u>76.57</u> | **35.9** | **72.63** |
240
+ | Deepseek-68b-Chat | 74.45 | <u>29.56</u> | <u>69.73</u> |
241
+ | OrionStar-Yi-34B-Chat | 54.36 | 12.8 | 62.88 |
242
+ | Yi-34B-Chat | 63.76 | 10.02 | 61.54 |
243
+
244
+ ## 其他任务能力
245
+
246
+ | Model | winogrande (5-shot) | arc (25-shot) | hellaswag (10-shot) | TruthfulQA mc1 (0-shot) | TruthfulQA mc2 (0-shot) |
247
+ |----------------------:|:-------------------:|:-------------:|:-------------------:|:-----------------------:|:-----------------------:|
248
+ | GPT-4 | — | 94.5 | 91.4 | 59.00 | — |
249
+ | SUS-Chat-34B | **81.22** | <u>81.54</u> | 83.79 | **40.64** | **57.47** |
250
+ | Qwen-72b-Chat | 76.09 | **82.10** | <u>86.06</u> | 39.17 | <u>56.37</u> |
251
+ | Deepseek-68b-Chat | <u>80.58</u> | 81.29 | **87.02** | <u>40.02</u> | 50.64 |
252
+ | OrionStar-Yi-34B-Chat | 77.27 | 80.19 | 84.54 | 36.47 | 53.24 |
253
+ | Yi-34B-Chat | 76.64 | 70.66 | 82.29 | 38.19 | 54.57 |
254
+
255
+ ## 综合能力
256
+
257
+ | Model | Average |
258
+ |----------------------:|:---------:|
259
+ | SUS-Chat-34B | **69.05** |
260
+ | Qwen-72b-Chat | 68.41 |
261
+ | Deepseek-68b-Chat | 62.91 |
262
+ | OrionStar-Yi-34B-Chat | 60.21 |
263
+ | Yi-34B-Chat | 59.72 |
264
+
265
+ 要复现我们的结果,请启动一个VLLM服务器并参考[这里](https://sustech-tlem.static.hf.space/index.html#start-evaluating-your-model-in-3-line)。
266
+
267
+ # 用法
268
+
269
+ SUS-Chat-34B是标准的LLaMA模型,应该可以无缝地与LLaMA生态系统兼容,我们提供下面的例子来展示如何使用它进行多轮对话
270
+
271
+ ``` python
272
+ # from transformers import AutoModelForCausalLM, AutoTokenizer # 🤗 Transformers, or
273
+ from modelscope import AutoModelForCausalLM, AutoTokenizer # 🤖 ModelScope
274
+
275
+
276
+ def chat_template(messages):
277
+ history = ""
278
+ for message in messages:
279
+ match message:
280
+ case {"role": "user", "content": message}:
281
+ history += f"### Human: {message}\n\n### Assistant: "
282
+ case {"role": "assistant", "content": message}:
283
+ history += message
284
+ return history
285
+
286
+
287
+ # model_path = "SUSTech/SUS-Chat-34B"
288
+ model_path = "SUSTC/SUS-Chat-34B" # ModelScope
289
+
290
+ tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
291
+ model = AutoModelForCausalLM.from_pretrained(
292
+ model_path, device_map="auto", torch_dtype="auto"
293
+ ).eval()
294
+
295
+ messages = [{"role": "user", "content": "hi"}]
296
+
297
+ input_ids = tokenizer.encode(
298
+ chat_template(messages), return_tensors="pt", add_special_tokens=False
299
+ ).to("cuda")
300
+ output_ids = model.generate(input_ids.to("cuda"), max_length=256)
301
+ response = tokenizer.decode(
302
+ output_ids[0][input_ids.shape[1] :], skip_special_tokens=False
303
+ )
304
+
305
+ messages.append({"role": "assistant", "content": response})
306
+
307
+ # Second round
308
+
309
+ messages.append({"role": "user", "content": "What is the capital of China?"})
310
+
311
+ input_ids = tokenizer.encode(
312
+ chat_template(messages), return_tensors="pt", add_special_tokens=False
313
+ ).to("cuda")
314
+ output_ids = model.generate(input_ids.to("cuda"), max_length=256)
315
+ response = tokenizer.decode(
316
+ output_ids[0][input_ids.shape[1] :], skip_special_tokens=False
317
+ )
318
+
319
+ messages.append({"role": "assistant", "content": response})
320
+ ```
321
+
322
+ # 限制
323
+
324
+ SUS-Chat只进行了监督微调,尚未进行人类偏好学习,因此在一些情况下可能会产生不合理的回复,并放大某些语言模型现有的问题,
325
+ 包括幻觉、非确定性和累积误差,
326
+ 为了实现更有利于下游任务的性能,我们建议相应地调整生成配置参数。
327
+
328
+ # 免责声明
329
+
330
+ 我们在训练过程中使用数据合规检查算法,尽力确保训练模型的合规性。由于数据复杂且语言模型使用场景多样,我们无法保证模型在所有情况下生成正确和合理的输出。请注意,模型仍然存在产生问题输出的风险。对于因滥用、误导、非法使用和相关错误信息以及相关数据安全问题而导致的任何风险和问题,我们将不承担责任。
331
+
332
+ # 许可
333
+
334
+ 该模型完全开发供学术研究和免费商业使用,但需要遵守来自[零一万物](https://huggingface.co/01-ai)的[许可](https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt)