|
24 | 24 |
|
25 | 25 | #### 已开源的模型 |
26 | 26 |
|
27 | | -- 基座模型:Chinese-LLaMA-2-7B, Chinese-LLaMA-2-13B |
28 | | -- 聊天模型:Chinese-Alpaca-2-7B, Chinese-Alpaca-2-13B |
| 27 | +- 基座模型:Chinese-LLaMA-2-1.3B, Chinese-LLaMA-2-7B, Chinese-LLaMA-2-13B |
| 28 | +- 聊天模型:Chinese-Alpaca-2-1.3B, Chinese-Alpaca-2-7B, Chinese-Alpaca-2-13B |
29 | 29 | - 长上下文模型:Chinese-LLaMA-2-7B-16K, Chinese-LLaMA-2-13B-16K, Chinese-Alpaca-2-7B-16K, Chinese-Alpaca-2-13B-16K |
30 | 30 |
|
31 | 31 |  |
|
101 | 101 | | 对比项 | 中文LLaMA-2 | 中文Alpaca-2 | |
102 | 102 | | :-------------------- | :----------------------------------------------------: | :----------------------------------------------------------: | |
103 | 103 | | 模型类型 | **基座模型** | **指令/Chat模型(类ChatGPT)** | |
104 | | -| 已开源大小 | 7B、13B | 7B、13B | |
| 104 | +| 已开源大小 | 1.3B、7B、13B | 1.3B、7B、13B | |
105 | 105 | | 训练类型 | Causal-LM (CLM) | 指令精调 | |
106 | | -| 训练方式 | LoRA + 全量emb/lm-head | LoRA + 全量emb/lm-head | |
| 106 | +| 训练方式 | 7B、13B:LoRA + 全量emb/lm-head<br/>1.3B:全量 | 7B、13B:LoRA + 全量emb/lm-head<br/>1.3B:全量 | |
107 | 107 | | 基于什么模型训练 | [原版Llama-2](https://github.com/facebookresearch/llama)(非chat版) | 中文LLaMA-2 | |
108 | 108 | | 训练语料 | 无标注通用语料(120G纯文本) | 有标注指令数据(500万条) | |
109 | 109 | | 词表大小<sup>[1]</sup> | 55,296 | 55,296 | |
|
116 | 116 | > [1] *本项目一代模型和二代模型的词表不同,请勿混用。二代LLaMA和Alpaca的词表相同。*</br> |
117 | 117 | > [2] *括号内表示基于NTK上下文扩展支持的最大长度。*</br> |
118 | 118 | > [3] *Alpaca-2采用了Llama-2-chat系列模板(格式相同,提示语不同),而不是一代Alpaca的模板,请勿混用。*</br> |
| 119 | +> [4] *不建议单独使用1.3B模型,而是通过投机采样搭配更大的模型(7B、13B)使用。*</br> |
119 | 120 |
|
120 | 121 | ### 完整模型下载 |
121 | 122 |
|
|
125 | 126 | | :------------------------ | :------: | :----------------------------------------------------------: | :----------------------------------------------------------: | |
126 | 127 | | Chinese-LLaMA-2-13B | 基座模型 | 24.7 GB | [[百度]](https://pan.baidu.com/s/1T3RqEUSmyg6ZuBwMhwSmoQ?pwd=e9qy) [[Google]](https://drive.google.com/drive/folders/1YNa5qJ0x59OEOI7tNODxea-1YvMPoH05?usp=share_link) [[🤗HF]](https://huggingface.co/ziqingyang/chinese-llama-2-13b) | |
127 | 128 | | Chinese-LLaMA-2-7B | 基座模型 | 12.9 GB | [[百度]](https://pan.baidu.com/s/1E5NI3nlQpx1j8z3eIzbIlg?pwd=n8k3) [[Google]](https://drive.google.com/drive/folders/18pp4I-mvQxRA7b8vF9gP-2cH_ocnXVKh?usp=share_link) [[🤗HF]](https://huggingface.co/ziqingyang/chinese-llama-2-7b) | |
| 129 | +| Chinese-LLaMA-2-1.3B | 基座模型 | 2.4 GB | [[🤗HF]](https://huggingface.co/ziqingyang/chinese-llama-2-1.3b) | |
128 | 130 | | Chinese-Alpaca-2-13B | 指令模型 | 24.7 GB | [[百度]](https://pan.baidu.com/s/1MT_Zlap1OtdYMgoBNTS3dg?pwd=9xja) [[Google]](https://drive.google.com/drive/folders/1MTsKlzR61xmbTR4hBWzQas_MOpUZsogN?usp=share_link) [[🤗HF]](https://huggingface.co/ziqingyang/chinese-alpaca-2-13b) | |
129 | 131 | | Chinese-Alpaca-2-7B | 指令模型 | 12.9 GB | [[百度]](https://pan.baidu.com/s/1wxx-CdgbMupXVRBcaN4Slw?pwd=kpn9) [[Google]](https://drive.google.com/drive/folders/1JsJDVs7tE2y31PBNleBlDPsB7S0ZrY8d?usp=share_link) [[🤗HF]](https://huggingface.co/ziqingyang/chinese-alpaca-2-7b) | |
| 132 | +| Chinese-Alpaca-2-1.3B | 指令模型 | 2.4 GB | [[🤗HF]](https://huggingface.co/ziqingyang/chinese-alpaca-2-1.3b) | |
130 | 133 |
|
131 | 134 | 以下是长上下文版模型,**推荐以长文本为主的下游任务使用**,否则建议使用上述标准版。 |
132 | 135 |
|
|
172 | 175 |
|
173 | 176 | 本项目中的相关模型主要支持以下量化、推理和部署方式,具体内容请参考对应教程。 |
174 | 177 |
|
175 | | -| 工具 | 特点 | CPU | GPU | 量化 | GUI | API | vLLM<sup>§</sup> | 16K<sup>‡</sup> | 教程 | |
176 | | -| :----------------------------------------------------------- | ---------------------------- | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | |
177 | | -| [**llama.cpp**](https://github.com/ggerganov/llama.cpp) | 丰富的量化选项和高效本地推理 | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/llamacpp_zh) | |
178 | | -| [**🤗Transformers**](https://github.com/huggingface/transformers) | 原生transformers推理接口 | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/inference_with_transformers_zh) | |
179 | | -| [**Colab Demo**](https://colab.research.google.com/drive/1yu0eZ3a66by8Zqm883LLtRQrguBAb9MR?usp=sharing) | 在Colab中启动交互界面 | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | [link](https://colab.research.google.com/drive/1yu0eZ3a66by8Zqm883LLtRQrguBAb9MR?usp=sharing) | |
180 | | -| [**仿OpenAI API调用**](https://platform.openai.com/docs/api-reference) | 仿OpenAI API接口的服务器Demo | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/api_calls_zh) | |
181 | | -| [**text-generation-webui**](https://github.com/oobabooga/text-generation-webui) | 前端Web UI界面的部署方式 | ✅ | ✅ | ✅ | ✅ | ✅<sup>†</sup> | ❌ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/text-generation-webui_zh) | |
182 | | -| [**LangChain**](https://github.com/hwchase17/langchain) | 适合二次开发的大模型应用开源框架 | ✅<sup>†</sup> | ✅ | ✅<sup>†</sup> | ❌ | ❌ | ❌ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/langchain_zh) | |
183 | | -| [**privateGPT**](https://github.com/imartinez/privateGPT) | 基于LangChain的多文档本地问答框架 | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/privategpt_zh) | |
| 178 | +| 工具 | 特点 | CPU | GPU | 量化 | GUI | API | vLLM<sup>§</sup> | 16K<sup>‡</sup> | 投机采样 | 教程 | |
| 179 | +| :----------------------------------------------------------- | ---------------------------- | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | |
| 180 | +| [**llama.cpp**](https://github.com/ggerganov/llama.cpp) | 丰富的量化选项和高效本地推理 | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/llamacpp_zh) | |
| 181 | +| [**🤗Transformers**](https://github.com/huggingface/transformers) | 原生transformers推理接口 | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/inference_with_transformers_zh) | |
| 182 | +| [**Colab Demo**](https://colab.research.google.com/drive/1yu0eZ3a66by8Zqm883LLtRQrguBAb9MR?usp=sharing) | 在Colab中启动交互界面 | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | [link](https://colab.research.google.com/drive/1yu0eZ3a66by8Zqm883LLtRQrguBAb9MR?usp=sharing) | |
| 183 | +| [**仿OpenAI API调用**](https://platform.openai.com/docs/api-reference) | 仿OpenAI API接口的服务器Demo | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/api_calls_zh) | |
| 184 | +| [**text-generation-webui**](https://github.com/oobabooga/text-generation-webui) | 前端Web UI界面的部署方式 | ✅ | ✅ | ✅ | ✅ | ✅<sup>†</sup> | ❌ | ✅ | ❌ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/text-generation-webui_zh) | |
| 185 | +| [**LangChain**](https://github.com/hwchase17/langchain) | 适合二次开发的大模型应用开源框架 | ✅<sup>†</sup> | ✅ | ✅<sup>†</sup> | ❌ | ❌ | ❌ | ✅ | ❌ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/langchain_zh) | |
| 186 | +| [**privateGPT**](https://github.com/imartinez/privateGPT) | 基于LangChain的多文档本地问答框架 | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | [link](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/privategpt_zh) | |
184 | 187 |
|
185 | 188 | > [!NOTE] |
186 | 189 | > <sup>†</sup> 工具支持该特性,但教程中未实现,详细说明请参考对应官方文档<br/> |
|
273 | 276 | | CPU Speed | 117 | 42 | 51 | 39 | 44 | 43 | 48 | 51 | 50 | 54 | 65 | |
274 | 277 | | GPU Speed | 53 | 19 | 21 | 17 | 18 | 20 | x | x | 25 | 26 | x | |
275 | 278 |
|
| 279 | +### 投机采样加速效果评测 |
| 280 | + |
| 281 | +通过投机采样方法并借助Chinese-LLaMA-2-1.3B和Chinese-Alpaca-2-1.3B,可以分别加速7B、13B的LLaMA和Alpaca模型的推理速度。以下是使用[投机采样脚本](scripts/inference/speculative_sample.py)在1*A40-48G上解码[生成效果评测](#生成效果评测)中的问题测得的平均速度(速度以ms/token计,模型均为fp16精度),供用户参考。详细说明见[📖GitHub Wiki](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/inference_with_transformers_zh#投机采样解码)。 |
| 282 | + |
| 283 | +| 草稿模型 | 草稿模型速度 | 目标模型 | 目标模型速度 | 投机采样速度(加速比) | |
| 284 | +| :---------- | :-----------------: | :----------- | :-----------------: | :--------: | |
| 285 | +| Chinese-LLaMA-2-1.3B | 7.6 | Chinese-LLaMA-2-7B | 49.3 | 36.0(1.37x) | |
| 286 | +| Chinese-LLaMA-2-1.3B | 7.6 | Chinese-LLaMA-2-13B | 66.0 | 47.1(1.40x) | |
| 287 | +| Chinese-Alpaca-2-1.3B | 8.1 | Chinese-Alpaca-2-7B | 50.2 | 34.9(1.44x) | |
| 288 | +| Chinese-Alpaca-2-1.3B | 8.2 | Chinese-Alpaca-2-13B | 67.0 | 41.6(1.61x) | |
| 289 | + |
276 | 290 | ## 训练与精调 |
277 | 291 |
|
278 | 292 | ### 预训练 |
|
0 commit comments