GGUF
RichardErkhov commited on
Commit
83ff4a4
1 Parent(s): 1b7b52c

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +1392 -0
README.md ADDED
@@ -0,0 +1,1392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ Yi-34B-Chat - GGUF
11
+ - Model creator: https://huggingface.co/01-ai/
12
+ - Original model: https://huggingface.co/01-ai/Yi-34B-Chat/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [Yi-34B-Chat.Q2_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q2_K.gguf) | Q2_K | 11.94GB |
18
+ | [Yi-34B-Chat.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.IQ3_XS.gguf) | IQ3_XS | 13.26GB |
19
+ | [Yi-34B-Chat.IQ3_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.IQ3_S.gguf) | IQ3_S | 13.99GB |
20
+ | [Yi-34B-Chat.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q3_K_S.gguf) | Q3_K_S | 13.93GB |
21
+ | [Yi-34B-Chat.IQ3_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.IQ3_M.gguf) | IQ3_M | 14.5GB |
22
+ | [Yi-34B-Chat.Q3_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q3_K.gguf) | Q3_K | 15.51GB |
23
+ | [Yi-34B-Chat.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q3_K_M.gguf) | Q3_K_M | 15.51GB |
24
+ | [Yi-34B-Chat.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q3_K_L.gguf) | Q3_K_L | 16.89GB |
25
+ | [Yi-34B-Chat.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.IQ4_XS.gguf) | IQ4_XS | 17.36GB |
26
+ | [Yi-34B-Chat.Q4_0.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q4_0.gguf) | Q4_0 | 18.13GB |
27
+ | [Yi-34B-Chat.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.IQ4_NL.gguf) | IQ4_NL | 18.3GB |
28
+ | [Yi-34B-Chat.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q4_K_S.gguf) | Q4_K_S | 18.25GB |
29
+ | [Yi-34B-Chat.Q4_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q4_K.gguf) | Q4_K | 19.24GB |
30
+ | [Yi-34B-Chat.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q4_K_M.gguf) | Q4_K_M | 19.24GB |
31
+ | [Yi-34B-Chat.Q4_1.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q4_1.gguf) | Q4_1 | 20.1GB |
32
+ | [Yi-34B-Chat.Q5_0.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q5_0.gguf) | Q5_0 | 22.08GB |
33
+ | [Yi-34B-Chat.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q5_K_S.gguf) | Q5_K_S | 22.08GB |
34
+ | [Yi-34B-Chat.Q5_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q5_K.gguf) | Q5_K | 22.65GB |
35
+ | [Yi-34B-Chat.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q5_K_M.gguf) | Q5_K_M | 22.65GB |
36
+ | [Yi-34B-Chat.Q5_1.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q5_1.gguf) | Q5_1 | 24.05GB |
37
+ | [Yi-34B-Chat.Q6_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-34B-Chat-gguf/blob/main/Yi-34B-Chat.Q6_K.gguf) | Q6_K | 26.28GB |
38
+
39
+
40
+
41
+
42
+ Original model description:
43
+ ---
44
+ license: other
45
+ license_name: yi-license
46
+ license_link: LICENSE
47
+ widget:
48
+ - example_title: "Yi-34B-Chat"
49
+ text: "hi"
50
+ output:
51
+ text: " Hello! How can I assist you today?"
52
+ - example_title: "Yi-34B"
53
+ text: "There's a place where time stands still. A place of breath taking wonder, but also"
54
+ output:
55
+ text: " an eerie sense that something is just not right…\nBetween the two worlds lies The Forgotten Kingdom - home to creatures long since thought extinct and ancient magic so strong it defies belief! Only here can you find what has been lost for centuries: An Elixir Of Life which will restore youth and vitality if only those who seek its power are brave enough to face up against all manner of dangers lurking in this mysterious land! But beware; some say there may even exist powerful entities beyond our comprehension whose intentions towards humanity remain unclear at best ---- they might want nothing more than destruction itself rather then anything else from their quest after immortality (and maybe someone should tell them about modern medicine)? In any event though – one thing remains true regardless : whether or not success comes easy depends entirely upon how much effort we put into conquering whatever challenges lie ahead along with having faith deep down inside ourselves too ;) So let’s get started now shall We?"
56
+ pipeline_tag: text-generation
57
+ ---
58
+
59
+ <div align="center">
60
+
61
+ <picture>
62
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_dark.svg" width="200px">
63
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg" width="200px">
64
+ <img alt="specify theme context for images" src="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg">
65
+ </picture>
66
+
67
+ </br>
68
+ </br>
69
+
70
+ <div style="display: inline-block;">
71
+ <a href="https://github.com/01-ai/Yi/actions/workflows/build_docker_image.yml">
72
+ <img src="https://github.com/01-ai/Yi/actions/workflows/build_docker_image.yml/badge.svg">
73
+ </a>
74
+ </div>
75
+
76
+ <div style="display: inline-block;">
77
+ <a href="https://github.com/01-ai/Yi/blob/main/LICENSE">
78
+ <img src="https://img.shields.io/badge/Code_License-Apache_2.0-lightblue">
79
+ </a>
80
+ </div>
81
+
82
+ <div style="display: inline-block;">
83
+ <a href="https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt">
84
+ <img src="https://img.shields.io/badge/Model_License-Yi_License-lightblue">
85
+ </a>
86
+ </div>
87
+
88
+ <div style="display: inline-block;">
89
+ <a href="mailto:oss@01.ai">
90
+ <img src="https://img.shields.io/badge/✉️-yi@01.ai-FFE01B">
91
+ </a>
92
+ </div>
93
+
94
+ </div>
95
+
96
+ <div align="center">
97
+ <h3 align="center">Building the Next Generation of Open-Source and Bilingual LLMs</h3>
98
+ </div>
99
+
100
+ <p align="center">
101
+ 🤗 <a href="https://huggingface.co/01-ai" target="_blank">Hugging Face</a> • 🤖 <a href="https://www.modelscope.cn/organization/01ai/" target="_blank">ModelScope</a> • ✡️ <a href="https://wisemodel.cn/organization/01.AI" target="_blank">WiseModel</a>
102
+ </p>
103
+
104
+ <p align="center">
105
+ 👩‍🚀 Ask questions or discuss ideas on <a href="https://github.com/01-ai/Yi/discussions" target="_blank"> GitHub </a>
106
+ </p>
107
+
108
+ <p align="center">
109
+ 👋 Join us on <a href="https://discord.gg/hYUwWddeAu" target="_blank"> 👾 Discord </a> or <a href="有官方的微信群嘛 · Issue #43 · 01-ai/Yi" target="_blank"> 💬 WeChat </a>
110
+ </p>
111
+
112
+ <p align="center">
113
+ 📝 Check out <a href="https://arxiv.org/abs/2403.04652"> Yi Tech Report </a>
114
+ </p>
115
+
116
+ <p align="center">
117
+ 📚 Grow at <a href="#learning-hub"> Yi Learning Hub </a>
118
+ </p>
119
+
120
+ <!-- DO NOT REMOVE ME -->
121
+
122
+ <hr>
123
+
124
+ <details open>
125
+ <summary></b>📕 Table of Contents</b></summary>
126
+
127
+ - [What is Yi?](#what-is-yi)
128
+ - [Introduction](#introduction)
129
+ - [Models](#models)
130
+ - [Chat models](#chat-models)
131
+ - [Base models](#base-models)
132
+ - [Model info](#model-info)
133
+ - [News](#news)
134
+ - [How to use Yi?](#how-to-use-yi)
135
+ - [Quick start](#quick-start)
136
+ - [Choose your path](#choose-your-path)
137
+ - [pip](#quick-start---pip)
138
+ - [docker](#quick-start---docker)
139
+ - [llama.cpp](#quick-start---llamacpp)
140
+ - [conda-lock](#quick-start---conda-lock)
141
+ - [Web demo](#web-demo)
142
+ - [Fine-tuning](#fine-tuning)
143
+ - [Quantization](#quantization)
144
+ - [Deployment](#deployment)
145
+ - [FAQ](#faq)
146
+ - [Learning hub](#learning-hub)
147
+ - [Why Yi?](#why-yi)
148
+ - [Ecosystem](#ecosystem)
149
+ - [Upstream](#upstream)
150
+ - [Downstream](#downstream)
151
+ - [Serving](#serving)
152
+ - [Quantization](#quantization-1)
153
+ - [Fine-tuning](#fine-tuning-1)
154
+ - [API](#api)
155
+ - [Benchmarks](#benchmarks)
156
+ - [Base model performance](#base-model-performance)
157
+ - [Chat model performance](#chat-model-performance)
158
+ - [Tech report](#tech-report)
159
+ - [Citation](#citation)
160
+ - [Who can use Yi?](#who-can-use-yi)
161
+ - [Misc.](#misc)
162
+ - [Acknowledgements](#acknowledgments)
163
+ - [Disclaimer](#disclaimer)
164
+ - [License](#license)
165
+
166
+ </details>
167
+
168
+ <hr>
169
+
170
+ # What is Yi?
171
+
172
+ ## Introduction
173
+
174
+ - 🤖 The Yi series models are the next generation of open-source large language models trained from scratch by [01.AI](https://01.ai/).
175
+
176
+ - 🙌 Targeted as a bilingual language model and trained on 3T multilingual corpus, the Yi series models become one of the strongest LLM worldwide, showing promise in language understanding, commonsense reasoning, reading comprehension, and more. For example,
177
+
178
+ - Yi-34B-Chat model **landed in second place (following GPT-4 Turbo)**, outperforming other LLMs (such as GPT-4, Mixtral, Claude) on the AlpacaEval Leaderboard (based on data available up to January 2024).
179
+
180
+ - Yi-34B model **ranked first among all existing open-source models** (such as Falcon-180B, Llama-70B, Claude) in **both English and Chinese** on various benchmarks, including Hugging Face Open LLM Leaderboard (pre-trained) and C-Eval (based on data available up to November 2023).
181
+
182
+ - 🙏 (Credits to Llama) Thanks to the Transformer and Llama open-source communities, as they reduce the efforts required to build from scratch and enable the utilization of the same tools within the AI ecosystem.
183
+
184
+ <details style="display: inline;"><summary> If you're interested in Yi's adoption of Llama architecture and license usage policy, see <span style="color: green;">Yi's relation with Llama.</span> ⬇️</summary> <ul> <br>
185
+
186
+ > 💡 TL;DR
187
+ >
188
+ > The Yi series models adopt the same model architecture as Llama but are **NOT** derivatives of Llama.
189
+
190
+ - Both Yi and Llama are based on the Transformer structure, which has been the standard architecture for large language models since 2018.
191
+
192
+ - Grounded in the Transformer architecture, Llama has become a new cornerstone for the majority of state-of-the-art open-source models due to its excellent stability, reliable convergence, and robust compatibility. This positions Llama as the recognized foundational framework for models including Yi.
193
+
194
+ - Thanks to the Transformer and Llama architectures, other models can leverage their power, reducing the effort required to build from scratch and enabling the utilization of the same tools within their ecosystems.
195
+
196
+ - However, the Yi series models are NOT derivatives of Llama, as they do not use Llama's weights.
197
+
198
+ - As Llama's structure is employed by the majority of open-source models, the key factors of determining model performance are training datasets, training pipelines, and training infrastructure.
199
+
200
+ - Developing in a unique and proprietary way, Yi has independently created its own high-quality training datasets, efficient training pipelines, and robust training infrastructure entirely from the ground up. This effort has led to excellent performance with Yi series models ranking just behind GPT4 and surpassing Llama on the [Alpaca Leaderboard in Dec 2023](https://tatsu-lab.github.io/alpaca_eval/).
201
+ </ul>
202
+ </details>
203
+
204
+ <p align="right"> [
205
+ <a href="#top">Back to top ⬆️ </a> ]
206
+ </p>
207
+
208
+ ## News
209
+
210
+ <details>
211
+ <summary>🎯 <b>2024-03-16</b>: The <code>Yi-9B-200K</code> is open-sourced and available to the public.</summary>
212
+ </details>
213
+
214
+ <details open>
215
+ <summary>🎯 <b>2024-03-08</b>: <a href="https://arxiv.org/abs/2403.04652">Yi Tech Report</a> is published! </summary>
216
+ </details>
217
+
218
+
219
+ <details open>
220
+ <summary>🔔 <b>2024-03-07</b>: The long text capability of the Yi-34B-200K has been enhanced. </summary>
221
+ <br>
222
+ In the "Needle-in-a-Haystack" test, the Yi-34B-200K's performance is improved by 10.5%, rising from 89.3% to an impressive 99.8%. We continue to pre-train the model on 5B tokens long-context data mixture and demonstrate a near-all-green performance.
223
+ </details>
224
+
225
+ <details open>
226
+ <summary>🎯 <b>2024-03-06</b>: The <code>Yi-9B</code> is open-sourced and available to the public.</summary>
227
+ <br>
228
+ <code>Yi-9B</code> stands out as the top performer among a range of similar-sized open-source models (including Mistral-7B, SOLAR-10.7B, Gemma-7B, DeepSeek-Coder-7B-Base-v1.5 and more), particularly excelling in code, math, common-sense reasoning, and reading comprehension.
229
+ </details>
230
+
231
+ <details open>
232
+ <summary>🎯 <b>2024-01-23</b>: The Yi-VL models, <code><a href="https://huggingface.co/01-ai/Yi-VL-34B">Yi-VL-34B</a></code> and <code><a href="https://huggingface.co/01-ai/Yi-VL-6B">Yi-VL-6B</a></code>, are open-sourced and available to the public.</summary>
233
+ <br>
234
+ <code><a href="https://huggingface.co/01-ai/Yi-VL-34B">Yi-VL-34B</a></code> has ranked <strong>first</strong> among all existing open-source models in the latest benchmarks, including <a href="https://arxiv.org/abs/2311.16502">MMMU</a> and <a href="https://arxiv.org/abs/2401.11944">CMMMU</a> (based on data available up to January 2024).</li>
235
+ </details>
236
+
237
+
238
+ <details>
239
+ <summary>🎯 <b>2023-11-23</b>: <a href="#chat-models">Chat models</a> are open-sourced and available to the public.</summary>
240
+ <br>This release contains two chat models based on previously released base models, two 8-bit models quantized by GPTQ, and two 4-bit models quantized by AWQ.
241
+
242
+ - `Yi-34B-Chat`
243
+ - `Yi-34B-Chat-4bits`
244
+ - `Yi-34B-Chat-8bits`
245
+ - `Yi-6B-Chat`
246
+ - `Yi-6B-Chat-4bits`
247
+ - `Yi-6B-Chat-8bits`
248
+
249
+ You can try some of them interactively at:
250
+
251
+ - [Hugging Face](https://huggingface.co/spaces/01-ai/Yi-34B-Chat)
252
+ - [Replicate](https://replicate.com/01-ai)
253
+ </details>
254
+
255
+ <details>
256
+ <summary>🔔 <b>2023-11-23</b>: The Yi Series Models Community License Agreement is updated to <a href="https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt">v2.1</a>.</summary>
257
+ </details>
258
+
259
+ <details>
260
+ <summary>🔥 <b>2023-11-08</b>: Invited test of Yi-34B chat model.</summary>
261
+ <br>Application form:
262
+
263
+ - [English](https://cn.mikecrm.com/l91ODJf)
264
+ - [Chinese](https://cn.mikecrm.com/gnEZjiQ)
265
+ </details>
266
+
267
+ <details>
268
+ <summary>🎯 <b>2023-11-05</b>: <a href="#base-models">The base models, </a><code>Yi-6B-200K</code> and <code>Yi-34B-200K</code>, are open-sourced and available to the public.</summary>
269
+ <br>This release contains two base models with the same parameter sizes as the previous
270
+ release, except that the context window is extended to 200K.
271
+ </details>
272
+
273
+ <details>
274
+ <summary>🎯 <b>2023-11-02</b>: <a href="#base-models">The base models, </a><code>Yi-6B</code> and <code>Yi-34B</code>, are open-sourced and available to the public.</summary>
275
+ <br>The first public release contains two bilingual (English/Chinese) base models
276
+ with the parameter sizes of 6B and 34B. Both of them are trained with 4K
277
+ sequence length and can be extended to 32K during inference time.
278
+
279
+ </details>
280
+
281
+ <p align="right"> [
282
+ <a href="#top">Back to top ⬆️ </a> ]
283
+ </p>
284
+
285
+ ## Models
286
+
287
+ Yi models come in multiple sizes and cater to different use cases. You can also fine-tune Yi models to meet your specific requirements.
288
+
289
+ If you want to deploy Yi models, make sure you meet the [software and hardware requirements](#deployment).
290
+
291
+ ### Chat models
292
+
293
+ | Model | Download
294
+ |---|---
295
+ Yi-34B-Chat | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B-Chat) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B-Chat/summary)
296
+ Yi-34B-Chat-4bits | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B-Chat-4bits) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B-Chat-4bits/summary)
297
+ Yi-34B-Chat-8bits | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B-Chat-8bits) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B-Chat-8bits/summary)
298
+ Yi-6B-Chat| • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B-Chat) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B-Chat/summary)
299
+ Yi-6B-Chat-4bits | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B-Chat-4bits) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B-Chat-4bits/summary)
300
+ Yi-6B-Chat-8bits | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B-Chat-8bits) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B-Chat-8bits/summary)
301
+
302
+
303
+ <sub><sup> - 4-bit series models are quantized by AWQ. <br> - 8-bit series models are quantized by GPTQ <br> - All quantized models have a low barrier to use since they can be deployed on consumer-grade GPUs (e.g., 3090, 4090). </sup></sub>
304
+
305
+ ### Base models
306
+
307
+ | Model | Download |
308
+ |---|---|
309
+ Yi-34B| • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B/summary)
310
+ Yi-34B-200K|• [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B-200K) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B-200K/summary)
311
+ Yi-9B|• [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-9B) • [🤖 ModelScope](https://wisemodel.cn/models/01.AI/Yi-9B)
312
+ Yi-9B-200K | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-9B-200K) • [🤖 ModelScope](https://wisemodel.cn/models/01.AI/Yi-9B-200K)
313
+ Yi-6B| • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B/summary)
314
+ Yi-6B-200K | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B-200K) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B-200K/summary)
315
+
316
+ <sub><sup> - 200k is roughly equivalent to 400,000 Chinese characters. <br> - If you want to use the previous version of the Yi-34B-200K (released on Nov 5, 2023), run `git checkout 069cd341d60f4ce4b07ec394e82b79e94f656cf` to download the weight. </sup></sub>
317
+
318
+ ### Model info
319
+
320
+ - For chat and base models
321
+
322
+ <table>
323
+ <thead>
324
+ <tr>
325
+ <th>Model</th>
326
+ <th>Intro</th>
327
+ <th>Default context window</th>
328
+ <th>Pretrained tokens</th>
329
+ <th>Training Data Date</th>
330
+ </tr>
331
+ </thead>
332
+ <tbody><tr>
333
+ <td>6B series models</td>
334
+ <td>They are suitable for personal and academic use.</td>
335
+ <td rowspan="3">4K</td>
336
+ <td>3T</td>
337
+ <td rowspan="3">Up to June 2023</td>
338
+ </tr>
339
+ <tr>
340
+ <td>9B series models</td>
341
+ <td>It is the best at coding and math in the Yi series models.</td>
342
+ <td>Yi-9B is continuously trained based on Yi-6B, using 0.8T tokens.</td>
343
+ </tr>
344
+ <tr>
345
+ <td>34B series models</td>
346
+ <td>They are suitable for personal, academic, and commercial (particularly for small and medium-sized enterprises) purposes. It&#39;s a cost-effective solution that&#39;s affordable and equipped with emergent ability.</td>
347
+ <td>3T</td>
348
+ </tr>
349
+ </tbody></table>
350
+
351
+
352
+ - For chat models
353
+
354
+ <details style="display: inline;"><summary>For chat model limitations, see the explanations below. ⬇️</summary>
355
+ <ul>
356
+ <br>The released chat model has undergone exclusive training using Supervised Fine-Tuning (SFT). Compared to other standard chat models, our model produces more diverse responses, making it suitable for various downstream tasks, such as creative scenarios. Furthermore, this diversity is expected to enhance the likelihood of generating higher quality responses, which will be advantageous for subsequent Reinforcement Learning (RL) training.
357
+
358
+ <br>However, this higher diversity might amplify certain existing issues, including:
359
+ <li>Hallucination: This refers to the model generating factually incorrect or nonsensical information. With the model's responses being more varied, there's a higher chance of hallucination that are not based on accurate data or logical reasoning.</li>
360
+ <li>Non-determinism in re-generation: When attempting to regenerate or sample responses, inconsistencies in the outcomes may occur. The increased diversity can lead to varying results even under similar input conditions.</li>
361
+ <li>Cumulative Error: This occurs when errors in the model's responses compound over time. As the model generates more diverse responses, the likelihood of small inaccuracies building up into larger errors increases, especially in complex tasks like extended reasoning, mathematical problem-solving, etc.</li>
362
+ <li>To achieve more coherent and consistent responses, it is advisable to adjust generation configuration parameters such as temperature, top_p, or top_k. These adjustments can help in the balance between creativity and coherence in the model's outputs.</li>
363
+ </ul>
364
+ </details>
365
+
366
+ <p align="right"> [
367
+ <a href="#top">Back to top ⬆️ </a> ]
368
+ </p>
369
+
370
+
371
+ # How to use Yi?
372
+
373
+ - [Quick start](#quick-start)
374
+ - [Choose your path](#choose-your-path)
375
+ - [pip](#quick-start---pip)
376
+ - [docker](#quick-start---docker)
377
+ - [conda-lock](#quick-start---conda-lock)
378
+ - [llama.cpp](#quick-start---llamacpp)
379
+ - [Web demo](#web-demo)
380
+ - [Fine-tuning](#fine-tuning)
381
+ - [Quantization](#quantization)
382
+ - [Deployment](#deployment)
383
+ - [FAQ](#faq)
384
+ - [Learning hub](#learning-hub)
385
+
386
+ ## Quick start
387
+
388
+ Getting up and running with Yi models is simple with multiple choices available.
389
+
390
+ ### Choose your path
391
+
392
+ Select one of the following paths to begin your journey with Yi!
393
+
394
+ ![Quick start - Choose your path](https://github.com/01-ai/Yi/blob/main/assets/img/quick_start_path.png?raw=true)
395
+
396
+ #### 🎯 Deploy Yi locally
397
+
398
+ If you prefer to deploy Yi models locally,
399
+
400
+ - 🙋‍♀️ and you have **sufficient** resources (for example, NVIDIA A800 80GB), you can choose one of the following methods:
401
+ - [pip](#quick-start---pip)
402
+ - [Docker](#quick-start---docker)
403
+ - [conda-lock](#quick-start---conda-lock)
404
+
405
+ - 🙋‍♀️ and you have **limited** resources (for example, a MacBook Pro), you can use [llama.cpp](#quick-start---llamacpp).
406
+
407
+ #### 🎯 Not to deploy Yi locally
408
+
409
+ If you prefer not to deploy Yi models locally, you can explore Yi's capabilities using any of the following options.
410
+
411
+ ##### 🙋‍♀️ Run Yi with APIs
412
+
413
+ If you want to explore more features of Yi, you can adopt one of these methods:
414
+
415
+ - Yi APIs (Yi official)
416
+ - [Early access has been granted](https://x.com/01AI_Yi/status/1735728934560600536?s=20) to some applicants. Stay tuned for the next round of access!
417
+
418
+ - [Yi APIs](https://replicate.com/01-ai/yi-34b-chat/api?tab=nodejs) (Replicate)
419
+
420
+ ##### 🙋‍♀️ Run Yi in playground
421
+
422
+ If you want to chat with Yi with more customizable options (e.g., system prompt, temperature, repetition penalty, etc.), you can try one of the following options:
423
+
424
+ - [Yi-34B-Chat-Playground](https://platform.lingyiwanwu.com/prompt/playground) (Yi official)
425
+ - Access is available through a whitelist. Welcome to apply (fill out a form in [English](https://cn.mikecrm.com/l91ODJf) or [Chinese](https://cn.mikecrm.com/gnEZjiQ)).
426
+
427
+ - [Yi-34B-Chat-Playground](https://replicate.com/01-ai/yi-34b-chat) (Replicate)
428
+
429
+ ##### 🙋‍♀️ Chat with Yi
430
+
431
+ If you want to chat with Yi, you can use one of these online services, which offer a similar user experience:
432
+
433
+ - [Yi-34B-Chat](https://huggingface.co/spaces/01-ai/Yi-34B-Chat) (Yi official on Hugging Face)
434
+ - No registration is required.
435
+
436
+ - [Yi-34B-Chat](https://platform.lingyiwanwu.com/) (Yi official beta)
437
+ - Access is available through a whitelist. Welcome to apply (fill out a form in [English](https://cn.mikecrm.com/l91ODJf) or [Chinese](https://cn.mikecrm.com/gnEZjiQ)).
438
+
439
+ <p align="right"> [
440
+ <a href="#top">Back to top ⬆️ </a> ]
441
+ </p>
442
+
443
+ ### Quick start - pip
444
+
445
+ This tutorial guides you through every step of running **Yi-34B-Chat locally on an A800 (80G)** and then performing inference.
446
+
447
+ #### Step 0: Prerequisites
448
+
449
+ - Make sure Python 3.10 or a later version is installed.
450
+
451
+ - If you want to run other Yi models, see [software and hardware requirements](#deployment).
452
+
453
+ #### Step 1: Prepare your environment
454
+
455
+ To set up the environment and install the required packages, execute the following command.
456
+
457
+ ```bash
458
+ git clone https://github.com/01-ai/Yi.git
459
+ cd yi
460
+ pip install -r requirements.txt
461
+ ```
462
+
463
+ #### Step 2: Download the Yi model
464
+
465
+ You can download the weights and tokenizer of Yi models from the following sources:
466
+
467
+ - [Hugging Face](https://huggingface.co/01-ai)
468
+ - [ModelScope](https://www.modelscope.cn/organization/01ai/)
469
+ - [WiseModel](https://wisemodel.cn/organization/01.AI)
470
+
471
+ #### Step 3: Perform inference
472
+
473
+ You can perform inference with Yi chat or base models as below.
474
+
475
+ ##### Perform inference with Yi chat model
476
+
477
+ 1. Create a file named `quick_start.py` and copy the following content to it.
478
+
479
+ ```python
480
+ from transformers import AutoModelForCausalLM, AutoTokenizer
481
+
482
+ model_path = '<your-model-path>'
483
+
484
+ tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
485
+
486
+ # Since transformers 4.35.0, the GPT-Q/AWQ model can be loaded using AutoModelForCausalLM.
487
+ model = AutoModelForCausalLM.from_pretrained(
488
+ model_path,
489
+ device_map="auto",
490
+ torch_dtype='auto'
491
+ ).eval()
492
+
493
+ # Prompt content: "hi"
494
+ messages = [
495
+ {"role": "user", "content": "hi"}
496
+ ]
497
+
498
+ input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
499
+ output_ids = model.generate(input_ids.to('cuda'))
500
+ response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
501
+
502
+ # Model response: "Hello! How can I assist you today?"
503
+ print(response)
504
+ ```
505
+
506
+ 2. Run `quick_start.py`.
507
+
508
+ ```bash
509
+ python quick_start.py
510
+ ```
511
+
512
+ Then you can see an output similar to the one below. 🥳
513
+
514
+ ```bash
515
+ Hello! How can I assist you today?
516
+ ```
517
+
518
+ ##### Perform inference with Yi base model
519
+
520
+ - Yi-34B
521
+
522
+ The steps are similar to [pip - Perform inference with Yi chat model](#perform-inference-with-yi-chat-model).
523
+
524
+ You can use the existing file [`text_generation.py`](https://github.com/01-ai/Yi/tree/main/demo).
525
+
526
+ ```bash
527
+ python demo/text_generation.py --model <your-model-path>
528
+ ```
529
+
530
+ Then you can see an output similar to the one below. 🥳
531
+
532
+ <details>
533
+
534
+ <summary>Output. ⬇️ </summary>
535
+
536
+ <br>
537
+
538
+ **Prompt**: Let me tell you an interesting story about cat Tom and mouse Jerry,
539
+
540
+ **Generation**: Let me tell you an interesting story about cat Tom and mouse Jerry, which happened in my childhood. My father had a big house with two cats living inside it to kill mice. One day when I was playing at home alone, I found one of the tomcats lying on his back near our kitchen door, looking very much like he wanted something from us but couldn’t get up because there were too many people around him! He kept trying for several minutes before finally giving up...
541
+
542
+ </details>
543
+
544
+ - Yi-9B
545
+
546
+ Input
547
+
548
+ ```bash
549
+ from transformers import AutoModelForCausalLM, AutoTokenizer
550
+
551
+ MODEL_DIR = "01-ai/Yi-9B"
552
+ model = AutoModelForCausalLM.from_pretrained(MODEL_DIR, torch_dtype="auto")
553
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR, use_fast=False)
554
+
555
+ input_text = "# write the quick sort algorithm"
556
+ inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
557
+ outputs = model.generate(**inputs, max_length=256)
558
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
559
+ ```
560
+
561
+ Output
562
+
563
+ ```bash
564
+ # write the quick sort algorithm
565
+ def quick_sort(arr):
566
+ if len(arr) <= 1:
567
+ return arr
568
+ pivot = arr[len(arr) // 2]
569
+ left = [x for x in arr if x < pivot]
570
+ middle = [x for x in arr if x == pivot]
571
+ right = [x for x in arr if x > pivot]
572
+ return quick_sort(left) + middle + quick_sort(right)
573
+
574
+ # test the quick sort algorithm
575
+ print(quick_sort([3, 6, 8, 10, 1, 2, 1]))
576
+ ```
577
+
578
+
579
+ <p align="right"> [
580
+ <a href="#top">Back to top ⬆️ </a> ]
581
+ </p>
582
+
583
+ ### Quick start - Docker
584
+ <details>
585
+ <summary> Run Yi-34B-chat locally with Docker: a step-by-step guide. ⬇️</summary>
586
+ <br>This tutorial guides you through every step of running <strong>Yi-34B-Chat on an A800 GPU</strong> or <strong>4*4090</strong> locally and then performing inference.
587
+ <h4>Step 0: Prerequisites</h4>
588
+ <p>Make sure you've installed <a href="https://docs.docker.com/engine/install/?open_in_browser=true">Docker</a> and <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html">nvidia-container-toolkit</a>.</p>
589
+
590
+ <h4> Step 1: Start Docker </h4>
591
+ <pre><code>docker run -it --gpus all \
592
+ -v &lt;your-model-path&gt;: /models
593
+ ghcr.io/01-ai/yi:latest
594
+ </code></pre>
595
+ <p>Alternatively, you can pull the Yi Docker image from <code>registry.lingyiwanwu.com/ci/01-ai/yi:latest</code>.</p>
596
+
597
+ <h4>Step 2: Perform inference</h4>
598
+ <p>You can perform inference with Yi chat or base models as below.</p>
599
+
600
+ <h5>Perform inference with Yi chat model</h5>
601
+ <p>The steps are similar to <a href="#perform-inference-with-yi-chat-model">pip - Perform inference with Yi chat model</a>.</p>
602
+ <p><strong>Note</strong> that the only difference is to set <code>model_path = '&lt;your-model-mount-path&gt;'</code> instead of <code>model_path = '&lt;your-model-path&gt;'</code>.</p>
603
+ <h5>Perform inference with Yi base model</h5>
604
+ <p>The steps are similar to <a href="#perform-inference-with-yi-base-model">pip - Perform inference with Yi base model</a>.</p>
605
+ <p><strong>Note</strong> that the only difference is to set <code>--model &lt;your-model-mount-path&gt;'</code> instead of <code>model &lt;your-model-path&gt;</code>.</p>
606
+ </details>
607
+
608
+ ### Quick start - conda-lock
609
+
610
+ <details>
611
+ <summary>You can use <code><a href="https://github.com/conda/conda-lock">conda-lock</a></code> to generate fully reproducible lock files for conda environments. ⬇️</summary>
612
+ <br>
613
+ You can refer to <a href="https://github.com/01-ai/Yi/blob/ebba23451d780f35e74a780987ad377553134f68/conda-lock.yml">conda-lock.yml</a> for the exact versions of the dependencies. Additionally, you can utilize <code><a href="https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html">micromamba</a></code> for installing these dependencies.
614
+ <br>
615
+ To install the dependencies, follow these steps:
616
+
617
+ 1. Install micromamba by following the instructions available <a href="https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html">here</a>.
618
+
619
+ 2. Execute <code>micromamba install -y -n yi -f conda-lock.yml</code> to create a conda environment named <code>yi</code> and install the necessary dependencies.
620
+ </details>
621
+
622
+
623
+ ### Quick start - llama.cpp
624
+ <a href="https://github.com/01-ai/Yi/blob/main/docs/README_llama.cpp.md">The following tutorial </a> will guide you through every step of running a quantized model (<a href="https://huggingface.co/XeIaso/yi-chat-6B-GGUF/tree/main">Yi-chat-6B-2bits</a>) locally and then performing inference.
625
+ <details>
626
+ <summary> Run Yi-chat-6B-2bits locally with llama.cpp: a step-by-step guide. ⬇️</summary>
627
+ <br><a href="https://github.com/01-ai/Yi/blob/main/docs/README_llama.cpp.md">This tutorial</a> guides you through every step of running a quantized model (<a href="https://huggingface.co/XeIaso/yi-chat-6B-GGUF/tree/main">Yi-chat-6B-2bits</a>) locally and then performing inference.</p>
628
+
629
+ - [Step 0: Prerequisites](#step-0-prerequisites)
630
+ - [Step 1: Download llama.cpp](#step-1-download-llamacpp)
631
+ - [Step 2: Download Yi model](#step-2-download-yi-model)
632
+ - [Step 3: Perform inference](#step-3-perform-inference)
633
+
634
+ #### Step 0: Prerequisites
635
+
636
+ - This tutorial assumes you use a MacBook Pro with 16GB of memory and an Apple M2 Pro chip.
637
+
638
+ - Make sure [`git-lfs`](https://git-lfs.com/) is installed on your machine.
639
+
640
+ #### Step 1: Download `llama.cpp`
641
+
642
+ To clone the [`llama.cpp`](https://github.com/ggerganov/llama.cpp) repository, run the following command.
643
+
644
+ ```bash
645
+ git clone git@github.com:ggerganov/llama.cpp.git
646
+ ```
647
+
648
+ #### Step 2: Download Yi model
649
+
650
+ 2.1 To clone [XeIaso/yi-chat-6B-GGUF](https://huggingface.co/XeIaso/yi-chat-6B-GGUF/tree/main) with just pointers, run the following command.
651
+
652
+ ```bash
653
+ GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/XeIaso/yi-chat-6B-GGUF
654
+ ```
655
+
656
+ 2.2 To download a quantized Yi model ([yi-chat-6b.Q2_K.gguf](https://huggingface.co/XeIaso/yi-chat-6B-GGUF/blob/main/yi-chat-6b.Q2_K.gguf)), run the following command.
657
+
658
+ ```bash
659
+ git-lfs pull --include yi-chat-6b.Q2_K.gguf
660
+ ```
661
+
662
+ #### Step 3: Perform inference
663
+
664
+ To perform inference with the Yi model, you can use one of the following methods.
665
+
666
+ - [Method 1: Perform inference in terminal](#method-1-perform-inference-in-terminal)
667
+
668
+ - [Method 2: Perform inference in web](#method-2-perform-inference-in-web)
669
+
670
+ ##### Method 1: Perform inference in terminal
671
+
672
+ To compile `llama.cpp` using 4 threads and then conduct inference, navigate to the `llama.cpp` directory, and run the following command.
673
+
674
+ > ##### Tips
675
+ >
676
+ > - Replace `/Users/yu/yi-chat-6B-GGUF/yi-chat-6b.Q2_K.gguf` with the actual path of your model.
677
+ >
678
+ > - By default, the model operates in completion mode.
679
+ >
680
+ > - For additional output customization options (for example, system prompt, temperature, repetition penalty, etc.), run `./main -h` to check detailed descriptions and usage.
681
+
682
+ ```bash
683
+ make -j4 && ./main -m /Users/yu/yi-chat-6B-GGUF/yi-chat-6b.Q2_K.gguf -p "How do you feed your pet fox? Please answer this question in 6 simple steps:\nStep 1:" -n 384 -e
684
+
685
+ ...
686
+
687
+ How do you feed your pet fox? Please answer this question in 6 simple steps:
688
+
689
+ Step 1: Select the appropriate food for your pet fox. You should choose high-quality, balanced prey items that are suitable for their unique dietary needs. These could include live or frozen mice, rats, pigeons, or other small mammals, as well as fresh fruits and vegetables.
690
+
691
+ Step 2: Feed your pet fox once or twice a day, depending on the species and its individual preferences. Always ensure that they have access to fresh water throughout the day.
692
+
693
+ Step 3: Provide an appropriate environment for your pet fox. Ensure it has a comfortable place to rest, plenty of space to move around, and opportunities to play and exercise.
694
+
695
+ Step 4: Socialize your pet with other animals if possible. Interactions with other creatures can help them develop social skills and prevent boredom or stress.
696
+
697
+ Step 5: Regularly check for signs of illness or discomfort in your fox. Be prepared to provide veterinary care as needed, especially for common issues such as parasites, dental health problems, or infections.
698
+
699
+ Step 6: Educate yourself about the needs of your pet fox and be aware of any potential risks or concerns that could affect their well-being. Regularly consult with a veterinarian to ensure you are providing the best care.
700
+
701
+ ...
702
+
703
+ ```
704
+
705
+ Now you have successfully asked a question to the Yi model and got an answer! 🥳
706
+
707
+ ##### Method 2: Perform inference in web
708
+
709
+ 1. To initialize a lightweight and swift chatbot, run the following command.
710
+
711
+ ```bash
712
+ cd llama.cpp
713
+ ./server --ctx-size 2048 --host 0.0.0.0 --n-gpu-layers 64 --model /Users/yu/yi-chat-6B-GGUF/yi-chat-6b.Q2_K.gguf
714
+ ```
715
+
716
+ Then you can get an output like this:
717
+
718
+
719
+ ```bash
720
+ ...
721
+
722
+ llama_new_context_with_model: n_ctx = 2048
723
+ llama_new_context_with_model: freq_base = 5000000.0
724
+ llama_new_context_with_model: freq_scale = 1
725
+ ggml_metal_init: allocating
726
+ ggml_metal_init: found device: Apple M2 Pro
727
+ ggml_metal_init: picking default device: Apple M2 Pro
728
+ ggml_metal_init: ggml.metallib not found, loading from source
729
+ ggml_metal_init: GGML_METAL_PATH_RESOURCES = nil
730
+ ggml_metal_init: loading '/Users/yu/llama.cpp/ggml-metal.metal'
731
+ ggml_metal_init: GPU name: Apple M2 Pro
732
+ ggml_metal_init: GPU family: MTLGPUFamilyApple8 (1008)
733
+ ggml_metal_init: hasUnifiedMemory = true
734
+ ggml_metal_init: recommendedMaxWorkingSetSize = 11453.25 MB
735
+ ggml_metal_init: maxTransferRate = built-in GPU
736
+ ggml_backend_metal_buffer_type_alloc_buffer: allocated buffer, size = 128.00 MiB, ( 2629.44 / 10922.67)
737
+ llama_new_context_with_model: KV self size = 128.00 MiB, K (f16): 64.00 MiB, V (f16): 64.00 MiB
738
+ ggml_backend_metal_buffer_type_alloc_buffer: allocated buffer, size = 0.02 MiB, ( 2629.45 / 10922.67)
739
+ llama_build_graph: non-view tensors processed: 676/676
740
+ llama_new_context_with_model: compute buffer total size = 159.19 MiB
741
+ ggml_backend_metal_buffer_type_alloc_buffer: allocated buffer, size = 156.02 MiB, ( 2785.45 / 10922.67)
742
+ Available slots:
743
+ -> Slot 0 - max context: 2048
744
+
745
+ llama server listening at http://0.0.0.0:8080
746
+ ```
747
+
748
+ 2. To access the chatbot interface, open your web browser and enter `http://0.0.0.0:8080` into the address bar.
749
+
750
+ ![Yi model chatbot interface - llama.cpp](https://github.com/01-ai/Yi/blob/main/assets/img/yi_llama_cpp1.png?raw=true)
751
+
752
+
753
+ 3. Enter a question, such as "How do you feed your pet fox? Please answer this question in 6 simple steps" into the prompt window, and you will receive a corresponding answer.
754
+
755
+ ![Ask a question to Yi model - llama.cpp](https://github.com/01-ai/Yi/blob/main/assets/img/yi_llama_cpp2.png?raw=true)
756
+
757
+ </ul>
758
+ </details>
759
+
760
+ <p align="right"> [
761
+ <a href="#top">Back to top ⬆️ </a> ]
762
+ </p>
763
+
764
+ ### Web demo
765
+
766
+ You can build a web UI demo for Yi **chat** models (note that Yi base models are not supported in this senario).
767
+
768
+ [Step 1: Prepare your environment](#step-1-prepare-your-environment).
769
+
770
+ [Step 2: Download the Yi model](#step-2-download-the-yi-model).
771
+
772
+ Step 3. To start a web service locally, run the following command.
773
+
774
+ ```bash
775
+ python demo/web_demo.py -c <your-model-path>
776
+ ```
777
+
778
+ You can access the web UI by entering the address provided in the console into your browser.
779
+
780
+ ![Quick start - web demo](https://github.com/01-ai/Yi/blob/main/assets/img/yi_34b_chat_web_demo.gif?raw=true)
781
+
782
+ <p align="right"> [
783
+ <a href="#top">Back to top ⬆️ </a> ]
784
+ </p>
785
+
786
+ ### Fine-tuning
787
+
788
+ ```bash
789
+ bash finetune/scripts/run_sft_Yi_6b.sh
790
+ ```
791
+
792
+ Once finished, you can compare the finetuned model and the base model with the following command:
793
+
794
+ ```bash
795
+ bash finetune/scripts/run_eval.sh
796
+ ```
797
+ <details style="display: inline;"><summary>For advanced usage (like fine-tuning based on your custom data), see the explanations below. ⬇️ </summary> <ul>
798
+
799
+ ### Finetune code for Yi 6B and 34B
800
+
801
+ #### Preparation
802
+
803
+ ##### From Image
804
+
805
+ By default, we use a small dataset from [BAAI/COIG](https://huggingface.co/datasets/BAAI/COIG) to finetune the base model.
806
+ You can also prepare your customized dataset in the following `jsonl` format:
807
+
808
+ ```json
809
+ { "prompt": "Human: Who are you? Assistant:", "chosen": "I'm Yi." }
810
+ ```
811
+
812
+ And then mount them in the container to replace the default ones:
813
+
814
+ ```bash
815
+ docker run -it \
816
+ -v /path/to/save/finetuned/model/:/finetuned-model \
817
+ -v /path/to/train.jsonl:/yi/finetune/data/train.json \
818
+ -v /path/to/eval.jsonl:/yi/finetune/data/eval.json \
819
+ ghcr.io/01-ai/yi:latest \
820
+ bash finetune/scripts/run_sft_Yi_6b.sh
821
+ ```
822
+
823
+ ##### From Local Server
824
+
825
+ Make sure you have conda. If not, use
826
+
827
+ ```bash
828
+ mkdir -p ~/miniconda3
829
+ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
830
+ bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
831
+ rm -rf ~/miniconda3/miniconda.sh
832
+ ~/miniconda3/bin/conda init bash
833
+ source ~/.bashrc
834
+ ```
835
+
836
+ Then, create a conda env:
837
+
838
+ ```bash
839
+ conda create -n dev_env python=3.10 -y
840
+ conda activate dev_env
841
+ pip install torch==2.0.1 deepspeed==0.10 tensorboard transformers datasets sentencepiece accelerate ray==2.7
842
+ ```
843
+
844
+ #### Hardware Setup
845
+
846
+ For the Yi-6B model, a node with 4 GPUs, each with GPU memory larger than 60GB, is recommended.
847
+
848
+ For the Yi-34B model, because the usage of the zero-offload technique consumes a lot of CPU memory, please be careful to limit the number of GPUs in the 34B finetune training. Please use CUDA_VISIBLE_DEVICES to limit the number of GPUs (as shown in scripts/run_sft_Yi_34b.sh).
849
+
850
+ A typical hardware setup for finetuning the 34B model is a node with 8 GPUs (limited to 4 in running by CUDA_VISIBLE_DEVICES=0,1,2,3), each with GPU memory larger than 80GB, and total CPU memory larger than 900GB.
851
+
852
+ #### Quick Start
853
+
854
+ Download a LLM-base model to MODEL_PATH (6B and 34B). A typical folder of models is like:
855
+
856
+ ```bash
857
+ |-- $MODEL_PATH
858
+ | |-- config.json
859
+ | |-- pytorch_model-00001-of-00002.bin
860
+ | |-- pytorch_model-00002-of-00002.bin
861
+ | |-- pytorch_model.bin.index.json
862
+ | |-- tokenizer_config.json
863
+ | |-- tokenizer.model
864
+ | |-- ...
865
+ ```
866
+
867
+ Download a dataset from huggingface to local storage DATA_PATH, e.g. Dahoas/rm-static.
868
+
869
+ ```bash
870
+ |-- $DATA_PATH
871
+ | |-- data
872
+ | | |-- train-00000-of-00001-2a1df75c6bce91ab.parquet
873
+ | | |-- test-00000-of-00001-8c7c51afc6d45980.parquet
874
+ | |-- dataset_infos.json
875
+ | |-- README.md
876
+ ```
877
+
878
+ `finetune/yi_example_dataset` has example datasets, which are modified from [BAAI/COIG](https://huggingface.co/datasets/BAAI/COIG)
879
+
880
+ ```bash
881
+ |-- $DATA_PATH
882
+ |--data
883
+ |-- train.jsonl
884
+ |-- eval.jsonl
885
+ ```
886
+
887
+ `cd` into the scripts folder, copy and paste the script, and run. For example:
888
+
889
+ ```bash
890
+ cd finetune/scripts
891
+
892
+ bash run_sft_Yi_6b.sh
893
+ ```
894
+
895
+ For the Yi-6B base model, setting training_debug_steps=20 and num_train_epochs=4 can output a chat model, which takes about 20 minutes.
896
+
897
+ For the Yi-34B base model, it takes a relatively long time for initialization. Please be patient.
898
+
899
+ #### Evaluation
900
+
901
+ ```bash
902
+ cd finetune/scripts
903
+
904
+ bash run_eval.sh
905
+ ```
906
+
907
+ Then you'll see the answer from both the base model and the finetuned model.
908
+ </ul>
909
+ </details>
910
+
911
+ <p align="right"> [
912
+ <a href="#top">Back to top ⬆️ </a> ]
913
+ </p>
914
+
915
+ ### Quantization
916
+
917
+ #### GPT-Q
918
+ ```bash
919
+ python quantization/gptq/quant_autogptq.py \
920
+ --model /base_model \
921
+ --output_dir /quantized_model \
922
+ --trust_remote_code
923
+ ```
924
+
925
+ Once finished, you can then evaluate the resulting model as follows:
926
+
927
+ ```bash
928
+ python quantization/gptq/eval_quantized_model.py \
929
+ --model /quantized_model \
930
+ --trust_remote_code
931
+ ```
932
+
933
+ <details style="display: inline;"><summary>For details, see the explanations below. ⬇️</summary> <ul>
934
+
935
+ #### GPT-Q quantization
936
+
937
+ [GPT-Q](https://github.com/IST-DASLab/gptq) is a PTQ (Post-Training Quantization)
938
+ method. It saves memory and provides potential speedups while retaining the accuracy
939
+ of the model.
940
+
941
+ Yi models can be GPT-Q quantized without a lot of efforts.
942
+ We provide a step-by-step tutorial below.
943
+
944
+ To run GPT-Q, we will use [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) and
945
+ [exllama](https://github.com/turboderp/exllama).
946
+ And the huggingface transformers has integrated optimum and auto-gptq to perform
947
+ GPTQ quantization on language models.
948
+
949
+ ##### Do Quantization
950
+
951
+ The `quant_autogptq.py` script is provided for you to perform GPT-Q quantization:
952
+
953
+ ```bash
954
+ python quant_autogptq.py --model /base_model \
955
+ --output_dir /quantized_model --bits 4 --group_size 128 --trust_remote_code
956
+ ```
957
+
958
+ ##### Run Quantized Model
959
+
960
+ You can run a quantized model using the `eval_quantized_model.py`:
961
+
962
+ ```bash
963
+ python eval_quantized_model.py --model /quantized_model --trust_remote_code
964
+ ```
965
+ </ul>
966
+ </details>
967
+
968
+ #### AWQ
969
+
970
+ ```bash
971
+ python quantization/awq/quant_autoawq.py \
972
+ --model /base_model \
973
+ --output_dir /quantized_model \
974
+ --trust_remote_code
975
+ ```
976
+
977
+ Once finished, you can then evaluate the resulting model as follows:
978
+
979
+ ```bash
980
+ python quantization/awq/eval_quantized_model.py \
981
+ --model /quantized_model \
982
+ --trust_remote_code
983
+ ```
984
+ <details style="display: inline;"><summary>For details, see the explanations below. ⬇️</summary> <ul>
985
+
986
+ #### AWQ quantization
987
+
988
+ [AWQ](https://github.com/mit-han-lab/llm-awq) is a PTQ (Post-Training Quantization)
989
+ method. It's an efficient and accurate low-bit weight quantization (INT3/4) for LLMs.
990
+
991
+ Yi models can be AWQ quantized without a lot of efforts.
992
+ We provide a step-by-step tutorial below.
993
+
994
+ To run AWQ, we will use [AutoAWQ](https://github.com/casper-hansen/AutoAWQ).
995
+
996
+ ##### Do Quantization
997
+
998
+ The `quant_autoawq.py` script is provided for you to perform AWQ quantization:
999
+
1000
+ ```bash
1001
+ python quant_autoawq.py --model /base_model \
1002
+ --output_dir /quantized_model --bits 4 --group_size 128 --trust_remote_code
1003
+ ```
1004
+
1005
+ ##### Run Quantized Model
1006
+
1007
+ You can run a quantized model using the `eval_quantized_model.py`:
1008
+
1009
+ ```bash
1010
+ python eval_quantized_model.py --model /quantized_model --trust_remote_code
1011
+ ```
1012
+
1013
+
1014
+ </ul>
1015
+ </details>
1016
+ <p align="right"> [
1017
+ <a href="#top">Back to top ⬆️ </a> ]
1018
+ </p>
1019
+
1020
+ ### Deployment
1021
+
1022
+ If you want to deploy Yi models, make sure you meet the software and hardware requirements.
1023
+
1024
+ #### Software requirements
1025
+
1026
+ Before using Yi quantized models, make sure you've installed the correct software listed below.
1027
+
1028
+ | Model | Software
1029
+ |---|---
1030
+ Yi 4-bit quantized models | [AWQ and CUDA](https://github.com/casper-hansen/AutoAWQ?tab=readme-ov-file#install-from-pypi)
1031
+ Yi 8-bit quantized models | [GPTQ and CUDA](https://github.com/PanQiWei/AutoGPTQ?tab=readme-ov-file#quick-installation)
1032
+
1033
+ #### Hardware requirements
1034
+
1035
+ Before deploying Yi in your environment, make sure your hardware meets the following requirements.
1036
+
1037
+ ##### Chat models
1038
+
1039
+ | Model | Minimum VRAM | Recommended GPU Example |
1040
+ |:----------------------|:--------------|:-------------------------------------:|
1041
+ | Yi-6B-Chat | 15 GB | 1 x RTX 3090 (24 GB) <br> 1 x RTX 4090 (24 GB) <br> 1 x A10 (24 GB) <br> 1 x A30 (24 GB) |
1042
+ | Yi-6B-Chat-4bits | 4 GB | 1 x RTX 3060 (12 GB)<br> 1 x RTX 4060 (8 GB) |
1043
+ | Yi-6B-Chat-8bits | 8 GB | 1 x RTX 3070 (8 GB) <br> 1 x RTX 4060 (8 GB) |
1044
+ | Yi-34B-Chat | 72 GB | 4 x RTX 4090 (24 GB)<br> 1 x A800 (80GB) |
1045
+ | Yi-34B-Chat-4bits | 20 GB | 1 x RTX 3090 (24 GB) <br> 1 x RTX 4090 (24 GB) <br> 1 x A10 (24 GB) <br> 1 x A30 (24 GB) <br> 1 x A100 (40 GB) |
1046
+ | Yi-34B-Chat-8bits | 38 GB | 2 x RTX 3090 (24 GB) <br> 2 x RTX 4090 (24 GB)<br> 1 x A800 (40 GB) |
1047
+
1048
+ Below are detailed minimum VRAM requirements under different batch use cases.
1049
+
1050
+ | Model | batch=1 | batch=4 | batch=16 | batch=32 |
1051
+ | ----------------------- | ------- | ------- | -------- | -------- |
1052
+ | Yi-6B-Chat | 12 GB | 13 GB | 15 GB | 18 GB |
1053
+ | Yi-6B-Chat-4bits | 4 GB | 5 GB | 7 GB | 10 GB |
1054
+ | Yi-6B-Chat-8bits | 7 GB | 8 GB | 10 GB | 14 GB |
1055
+ | Yi-34B-Chat | 65 GB | 68 GB | 76 GB | > 80 GB |
1056
+ | Yi-34B-Chat-4bits | 19 GB | 20 GB | 30 GB | 40 GB |
1057
+ | Yi-34B-Chat-8bits | 35 GB | 37 GB | 46 GB | 58 GB |
1058
+
1059
+ ##### Base models
1060
+
1061
+ | Model | Minimum VRAM | Recommended GPU Example |
1062
+ |----------------------|--------------|:-------------------------------------:|
1063
+ | Yi-6B | 15 GB | 1 x RTX 3090 (24 GB) <br> 1 x RTX 4090 (24 GB) <br> 1 x A10 (24 GB) <br> 1 x A30 (24 GB) |
1064
+ | Yi-6B-200K | 50 GB | 1 x A800 (80 GB) |
1065
+ | Yi-9B | 20 GB | 1 x RTX 4090 (24 GB) |
1066
+ | Yi-34B | 72 GB | 4 x RTX 4090 (24 GB) <br> 1 x A800 (80 GB) |
1067
+ | Yi-34B-200K | 200 GB | 4 x A800 (80 GB) |
1068
+
1069
+ <p align="right"> [
1070
+ <a href="#top">Back to top ⬆️ </a> ]
1071
+ </p>
1072
+
1073
+ ### FAQ
1074
+ <details>
1075
+ <summary> If you have any questions while using the Yi series models, the answers provided below could serve as a helpful reference for you. ⬇️</summary>
1076
+ <br>
1077
+
1078
+ #### 💡Fine-tuning
1079
+ - <strong>Base model or Chat model - which to fine-tune?</strong>
1080
+ <br>The choice of pre-trained language model for fine-tuning hinges on the computational resources you have at your disposal and the particular demands of your task.
1081
+ - If you are working with a substantial volume of fine-tuning data (say, over 10,000 samples), the Base model could be your go-to choice.
1082
+ - On the other hand, if your fine-tuning data is not quite as extensive, opting for the Chat model might be a more fitting choice.
1083
+ - It is generally advisable to fine-tune both the Base and Chat models, compare their performance, and then pick the model that best aligns with your specific requirements.
1084
+ - <strong>Yi-34B versus Yi-34B-Chat for full-scale fine-tuning - what is the difference?</strong>
1085
+ <br>
1086
+ The key distinction between full-scale fine-tuning on `Yi-34B`and `Yi-34B-Chat` comes down to the fine-tuning approach and outcomes.
1087
+ - Yi-34B-Chat employs a Special Fine-Tuning (SFT) method, resulting in responses that mirror human conversation style more closely.
1088
+ - The Base model's fine-tuning is more versatile, with a relatively high performance potential.
1089
+ - If you are confident in the quality of your data, fine-tuning with `Yi-34B` could be your go-to.
1090
+ - If you are aiming for model-generated responses that better mimic human conversational style, or if you have doubts about your data quality, `Yi-34B-Chat` might be your best bet.
1091
+
1092
+ #### 💡Quantization
1093
+ - <strong>Quantized model versus original model - what is the performance gap?</strong>
1094
+ - The performance variance is largely contingent on the quantization method employed and the specific use cases of these models. For instance, when it comes to models provided by the AWQ official, from a Benchmark standpoint, quantization might result in a minor performance drop of a few percentage points.
1095
+ - Subjectively speaking, in situations like logical reasoning, even a 1% performance shift could impact the accuracy of the output results.
1096
+
1097
+ #### 💡General
1098
+ - <strong>Where can I source fine-tuning question answering datasets?</strong>
1099
+ - You can find fine-tuning question answering datasets on platforms like Hugging Face, with datasets like [m-a-p/COIG-CQIA](https://huggingface.co/datasets/m-a-p/COIG-CQIA) readily available.
1100
+ - Additionally, Github offers fine-tuning frameworks, such as [hiyouga/LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory), which integrates pre-made datasets.
1101
+
1102
+ - <strong>What is the GPU memory requirement for fine-tuning Yi-34B FP16?</strong>
1103
+ <br>
1104
+ The GPU memory needed for fine-tuning 34B FP16 hinges on the specific fine-tuning method employed. For full parameter fine-tuning, you'll need 8 GPUs each with 80 GB; however, more economical solutions like Lora require less. For more details, check out [hiyouga/LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory). Also, consider using BF16 instead of FP16 for fine-tuning to optimize performance.
1105
+
1106
+ - <strong>Are there any third-party platforms that support chat functionality for the Yi-34b-200k model?</strong>
1107
+ <br>
1108
+ If you're looking for third-party Chats, options include [fireworks.ai](https://fireworks.ai/login?callbackURL=https://fireworks.ai/models/fireworks/yi-34b-chat).
1109
+ </details>
1110
+
1111
+ ### Learning hub
1112
+
1113
+ <details>
1114
+ <summary> If you want to learn Yi, you can find a wealth of helpful educational resources here. ⬇️</summary>
1115
+ <br>
1116
+
1117
+ Welcome to the Yi learning hub!
1118
+
1119
+ Whether you're a seasoned developer or a newcomer, you can find a wealth of helpful educational resources to enhance your understanding and skills with Yi models, including insightful blog posts, comprehensive video tutorials, hands-on guides, and more.
1120
+
1121
+ The content you find here has been generously contributed by knowledgeable Yi experts and passionate enthusiasts. We extend our heartfelt gratitude for your invaluable contributions!
1122
+
1123
+ At the same time, we also warmly invite you to join our collaborative effort by contributing to Yi. If you have already made contributions to Yi, please don't hesitate to showcase your remarkable work in the table below.
1124
+
1125
+ With all these resources at your fingertips, you're ready to start your exciting journey with Yi. Happy learning! 🥳
1126
+
1127
+ #### Tutorials
1128
+
1129
+ ##### English tutorials
1130
+
1131
+ | Type | Deliverable | Date | Author |
1132
+ |-------------|--------------------------------------------------------|----------------|----------------|
1133
+ | Video | [Run dolphin-2.2-yi-34b on IoT Devices](https://www.youtube.com/watch?v=NJ89T5mO25Y) | 2023-11-30 | [Second State](https://github.com/second-state) |
1134
+ | Blog | [Running Yi-34B-Chat locally using LlamaEdge](https://www.secondstate.io/articles/yi-34b/) | 2023-11-30 | [Second State](https://github.com/second-state) |
1135
+ | Video | [Install Yi 34B Locally - Chinese English Bilingual LLM](https://www.youtube.com/watch?v=CVQvj4Wrh4w&t=476s) | 2023-11-05 | [Fahd Mirza](https://www.youtube.com/@fahdmirza) |
1136
+ | Video | [Dolphin Yi 34b - Brand New Foundational Model TESTED](https://www.youtube.com/watch?v=On3Zuv27V3k&t=85s) | 2023-11-27 | [Matthew Berman](https://www.youtube.com/@matthew_berman) |
1137
+
1138
+ ##### Chinese tutorials
1139
+
1140
+ | Type | Deliverable | Date | Author |
1141
+ |-------------|--------------------------------------------------------|----------------|----------------|
1142
+ | GitHub project | [基于零一万物 Yi 模型和 B 站构建大语言模型高质量训练数据集](https://github.com/zjrwtx/bilibiliQA_databuilder) | 2024-04-29 | [正经人王同学](https://github.com/zjrwtx) |
1143
+ | GitHub project | [基于视频网站和零一万物大模型构建大语言模型高质量训练数据集](https://github.com/zjrwtx/VideoQA_databuilder) | 2024-04-25 | [正经人王同学](https://github.com/zjrwtx) |
1144
+ | Blog | [基于零一万物yi-vl-plus大模型简单几步就能批量生成Anki图片笔记](https://mp.weixin.qq.com/s/_ea6g0pzzeO4WyYtuWycWQ) | 2024-04-24 | [正经人王同学](https://github.com/zjrwtx) |
1145
+ | GitHub project | [基于零一万物yi-34b-chat-200k输入任意文章地址,点击按钮即可生成无广告或推广内容的简要笔记,并生成分享图给好友](https://github.com/zjrwtx/open_summary) | 2024-04-24 | [正经人王同学](https://github.com/zjrwtx) |
1146
+ | Blog | [实测零一万物Yi-VL多模态语言模型:能准确“识图吃瓜”](https://mp.weixin.qq.com/s/fu4O9XvJ03JhimsEyI-SsQ) | 2024-02-02 | [苏洋](https://github.com/soulteary) |
1147
+ | Blog | [本地运行零一万物 34B 大模型,使用 Llama.cpp & 21G 显存](https://zhuanlan.zhihu.com/p/668921042) | 2023-11-26 | [苏洋](https://github.com/soulteary) |
1148
+ | Blog | [零一万物模型折腾笔记:官方 Yi-34B 模型基础使用](https://zhuanlan.zhihu.com/p/671387298) | 2023-12-10 | [苏洋](https://github.com/soulteary) |
1149
+ | Blog | [CPU 混合推理,非常见大模型量化方案:“二三五六” 位量化方案](https://zhuanlan.zhihu.com/p/671698216) | 2023-12-12 | [苏洋](https://github.com/soulteary) |
1150
+ | Blog | [单卡 3 小时训练 Yi-6B 大模型 Agent:基于 Llama Factory 实战](https://zhuanlan.zhihu.com/p/678989191) | 2024-01-22 | [郑耀威](https://github.com/hiyouga) |
1151
+ | Blog | [零一万物开源Yi-VL多模态大模型,魔搭社区推理&微调最佳实践来啦!](https://zhuanlan.zhihu.com/p/680098411) | 2024-01-26 | [ModelScope](https://github.com/modelscope) |
1152
+ | Video | [只需 24G 显存,用 vllm 跑起来 Yi-34B 中英双语大模型](https://www.bilibili.com/video/BV17t4y1f7Ee/) | 2023-12-28 | [���妮妮](https://space.bilibili.com/1262370256) |
1153
+ | Video | [Yi-VL-34B 多模态大模型 - 用两张 A40 显卡跑起来](https://www.bilibili.com/video/BV1Q5411y7AG/) | 2023-01-28 | [漆妮妮](https://space.bilibili.com/1262370256) |
1154
+
1155
+ </details>
1156
+
1157
+
1158
+ # Why Yi?
1159
+
1160
+ - [Ecosystem](#ecosystem)
1161
+ - [Upstream](#upstream)
1162
+ - [Downstream](#downstream)
1163
+ - [Serving](#serving)
1164
+ - [Quantization](#quantization-1)
1165
+ - [Fine-tuning](#fine-tuning-1)
1166
+ - [API](#api)
1167
+ - [Benchmarks](#benchmarks)
1168
+ - [Chat model performance](#chat-model-performance)
1169
+ - [Base model performance](#base-model-performance)
1170
+ - [Yi-34B and Yi-34B-200K](#yi-34b-and-yi-34b-200k)
1171
+ - [Yi-9B](#yi-9b)
1172
+
1173
+ ## Ecosystem
1174
+
1175
+ Yi has a comprehensive ecosystem, offering a range of tools, services, and models to enrich your experiences and maximize productivity.
1176
+
1177
+ - [Upstream](#upstream)
1178
+ - [Downstream](#downstream)
1179
+ - [Serving](#serving)
1180
+ - [Quantization](#quantization-1)
1181
+ - [Fine-tuning](#fine-tuning-1)
1182
+ - [API](#api)
1183
+
1184
+ ### Upstream
1185
+
1186
+ The Yi series models follow the same model architecture as Llama. By choosing Yi, you can leverage existing tools, libraries, and resources within the Llama ecosystem, eliminating the need to create new tools and enhancing development efficiency.
1187
+
1188
+ For example, the Yi series models are saved in the format of the Llama model. You can directly use `LlamaForCausalLM` and `LlamaTokenizer` to load the model. For more information, see [Use the chat model](#31-use-the-chat-model).
1189
+
1190
+ ```python
1191
+ from transformers import AutoModelForCausalLM, AutoTokenizer
1192
+
1193
+ tokenizer = AutoTokenizer.from_pretrained("01-ai/Yi-34b", use_fast=False)
1194
+
1195
+ model = AutoModelForCausalLM.from_pretrained("01-ai/Yi-34b", device_map="auto")
1196
+ ```
1197
+
1198
+ <p align="right"> [
1199
+ <a href="#top">Back to top ⬆️ </a> ]
1200
+ </p>
1201
+
1202
+ ### Downstream
1203
+
1204
+ > 💡 Tip
1205
+ >
1206
+ > - Feel free to create a PR and share the fantastic work you've built using the Yi series models.
1207
+ >
1208
+ > - To help others quickly understand your work, it is recommended to use the format of `<model-name>: <model-intro> + <model-highlights>`.
1209
+
1210
+ #### Serving
1211
+
1212
+ If you want to get up with Yi in a few minutes, you can use the following services built upon Yi.
1213
+
1214
+ - Yi-34B-Chat: you can chat with Yi using one of the following platforms:
1215
+ - [Yi-34B-Chat | Hugging Face](https://huggingface.co/spaces/01-ai/Yi-34B-Chat)
1216
+ - [Yi-34B-Chat | Yi Platform](https://platform.lingyiwanwu.com/): **Note** that currently it's available through a whitelist. Welcome to apply (fill out a form in [English](https://cn.mikecrm.com/l91ODJf) or [Chinese](https://cn.mikecrm.com/gnEZjiQ)) and experience it firsthand!
1217
+
1218
+ - [Yi-6B-Chat (Replicate)](https://replicate.com/01-ai): you can use this model with more options by setting additional parameters and calling APIs.
1219
+
1220
+ - [ScaleLLM](https://github.com/vectorch-ai/ScaleLLM#supported-models): you can use this service to run Yi models locally with added flexibility and customization.
1221
+
1222
+ #### Quantization
1223
+
1224
+ If you have limited computational capabilities, you can use Yi's quantized models as follows.
1225
+
1226
+ These quantized models have reduced precision but offer increased efficiency, such as faster inference speed and smaller RAM usage.
1227
+
1228
+ - [TheBloke/Yi-34B-GPTQ](https://huggingface.co/TheBloke/Yi-34B-GPTQ)
1229
+ - [TheBloke/Yi-34B-GGUF](https://huggingface.co/TheBloke/Yi-34B-GGUF)
1230
+ - [TheBloke/Yi-34B-AWQ](https://huggingface.co/TheBloke/Yi-34B-AWQ)
1231
+
1232
+ #### Fine-tuning
1233
+
1234
+ If you're seeking to explore the diverse capabilities within Yi's thriving family, you can delve into Yi's fine-tuned models as below.
1235
+
1236
+ - [TheBloke Models](https://huggingface.co/TheBloke): this site hosts numerous fine-tuned models derived from various LLMs including Yi.
1237
+
1238
+ This is not an exhaustive list for Yi, but to name a few sorted on downloads:
1239
+ - [TheBloke/dolphin-2_2-yi-34b-AWQ](https://huggingface.co/TheBloke/dolphin-2_2-yi-34b-AWQ)
1240
+ - [TheBloke/Yi-34B-Chat-AWQ](https://huggingface.co/TheBloke/Yi-34B-Chat-AWQ)
1241
+ - [TheBloke/Yi-34B-Chat-GPTQ](https://huggingface.co/TheBloke/Yi-34B-Chat-GPTQ)
1242
+
1243
+ - [SUSTech/SUS-Chat-34B](https://huggingface.co/SUSTech/SUS-Chat-34B): this model ranked first among all models below 70B and outperformed the twice larger deepseek-llm-67b-chat. You can check the result on the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
1244
+
1245
+ - [OrionStarAI/OrionStar-Yi-34B-Chat-Llama](https://huggingface.co/OrionStarAI/OrionStar-Yi-34B-Chat-Llama): this model excelled beyond other models (such as GPT-4, Qwen-14B-Chat, Baichuan2-13B-Chat) in C-Eval and CMMLU evaluations on the [OpenCompass LLM Leaderboard](https://opencompass.org.cn/leaderboard-llm).
1246
+
1247
+ - [NousResearch/Nous-Capybara-34B](https://huggingface.co/NousResearch/Nous-Capybara-34B): this model is trained with 200K context length and 3 epochs on the Capybara dataset.
1248
+
1249
+ #### API
1250
+
1251
+ - [amazing-openai-api](https://github.com/soulteary/amazing-openai-api): this tool converts Yi model APIs into the OpenAI API format out of the box.
1252
+ - [LlamaEdge](https://www.secondstate.io/articles/yi-34b/#create-an-openai-compatible-api-service-for-the-yi-34b-chat-model): this tool builds an OpenAI-compatible API server for Yi-34B-Chat using a portable Wasm (WebAssembly) file, powered by Rust.
1253
+
1254
+ <p align="right"> [
1255
+ <a href="#top">Back to top ⬆️ </a> ]
1256
+ </p>
1257
+
1258
+ ## Tech report
1259
+
1260
+ For detailed capabilities of the Yi series model, see [Yi: Open Foundation Models by 01.AI](https://arxiv.org/abs/2403.04652).
1261
+
1262
+ ### Citation
1263
+
1264
+ ```
1265
+ @misc{ai2024yi,
1266
+ title={Yi: Open Foundation Models by 01.AI},
1267
+ author={01. AI and : and Alex Young and Bei Chen and Chao Li and Chengen Huang and Ge Zhang and Guanwei Zhang and Heng Li and Jiangcheng Zhu and Jianqun Chen and Jing Chang and Kaidong Yu and Peng Liu and Qiang Liu and Shawn Yue and Senbin Yang and Shiming Yang and Tao Yu and Wen Xie and Wenhao Huang and Xiaohui Hu and Xiaoyi Ren and Xinyao Niu and Pengcheng Nie and Yuchi Xu and Yudong Liu and Yue Wang and Yuxuan Cai and Zhenyu Gu and Zhiyuan Liu and Zonghong Dai},
1268
+ year={2024},
1269
+ eprint={2403.04652},
1270
+ archivePrefix={arXiv},
1271
+ primaryClass={cs.CL}
1272
+ }
1273
+ ```
1274
+
1275
+ ## Benchmarks
1276
+
1277
+ - [Chat model performance](#chat-model-performance)
1278
+ - [Base model performance](#base-model-performance)
1279
+
1280
+ ### Chat model performance
1281
+
1282
+ Yi-34B-Chat model demonstrates exceptional performance, ranking first among all existing open-source models in the benchmarks including MMLU, CMMLU, BBH, GSM8k, and more.
1283
+
1284
+ ![Chat model performance](https://github.com/01-ai/Yi/blob/main/assets/img/benchmark_chat.png?raw=true)
1285
+
1286
+ <details>
1287
+ <summary> Evaluation methods and challenges. ⬇️ </summary>
1288
+
1289
+ - **Evaluation methods**: we evaluated various benchmarks using both zero-shot and few-shot methods, except for TruthfulQA.
1290
+ - **Zero-shot vs. few-shot**: in chat models, the zero-shot approach is more commonly employed.
1291
+ - **Evaluation strategy**: our evaluation strategy involves generating responses while following instructions explicitly or implicitly (such as using few-shot examples). We then isolate relevant answers from the generated text.
1292
+ - **Challenges faced**: some models are not well-suited to produce output in the specific format required by instructions in few datasets, which leads to suboptimal results.
1293
+
1294
+ <strong>*</strong>: C-Eval results are evaluated on the validation datasets
1295
+ </details>
1296
+
1297
+ ### Base model performance
1298
+
1299
+ #### Yi-34B and Yi-34B-200K
1300
+
1301
+ The Yi-34B and Yi-34B-200K models stand out as the top performers among open-source models, especially excelling in MMLU, CMMLU, common-sense reasoning, reading comprehension, and more.
1302
+
1303
+ ![Base model performance](https://github.com/01-ai/Yi/blob/main/assets/img/benchmark_base.png?raw=true)
1304
+
1305
+ <details>
1306
+ <summary> Evaluation methods. ⬇️</summary>
1307
+
1308
+ - **Disparity in results**: while benchmarking open-source models, a disparity has been noted between results from our pipeline and those reported by public sources like OpenCompass.
1309
+ - **Investigation findings**: a deeper investigation reveals that variations in prompts, post-processing strategies, and sampling techniques across models may lead to significant outcome differences.
1310
+ - **Uniform benchmarking process**: our methodology aligns with the original benchmarks—consistent prompts and post-processing strategies are used, and greedy decoding is applied during evaluations without any post-processing for the generated content.
1311
+ - **Efforts to retrieve unreported scores**: for scores that were not reported by the original authors (including scores reported with different settings), we try to get results with our pipeline.
1312
+ - **Extensive model evaluation**: to evaluate the model’s capability extensively, we adopted the methodology outlined in Llama2. Specifically, we included PIQA, SIQA, HellaSwag, WinoGrande, ARC, OBQA, and CSQA to assess common sense reasoning. SquAD, QuAC, and BoolQ were incorporated to evaluate reading comprehension.
1313
+ - **Special configurations**: CSQA was exclusively tested using a 7-shot setup, while all other tests were conducted with a 0-shot configuration. Additionally, we introduced GSM8K (8-shot@1), MATH (4-shot@1), HumanEval (0-shot@1), and MBPP (3-shot@1) under the category "Math & Code".
1314
+ - **Falcon-180B caveat**: Falcon-180B was not tested on QuAC and OBQA due to technical constraints. Its performance score is an average from other tasks, and considering the generally lower scores of these two tasks, Falcon-180B's capabilities are likely not underestimated.
1315
+ </details>
1316
+
1317
+ #### Yi-9B
1318
+
1319
+ Yi-9B is almost the best among a range of similar-sized open-source models (including Mistral-7B, SOLAR-10.7B, Gemma-7B, DeepSeek-Coder-7B-Base-v1.5 and more), particularly excelling in code, math, common-sense reasoning, and reading comprehension.
1320
+
1321
+ ![Yi-9B benchmark - details](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_details.png?raw=true)
1322
+
1323
+ - In terms of **overall** ability (Mean-All), Yi-9B performs the best among similarly sized open-source models, surpassing DeepSeek-Coder, DeepSeek-Math, Mistral-7B, SOLAR-10.7B, and Gemma-7B.
1324
+
1325
+ ![Yi-9B benchmark - overall](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_overall.png?raw=true)
1326
+
1327
+ - In terms of **coding** ability (Mean-Code), Yi-9B's performance is second only to DeepSeek-Coder-7B, surpassing Yi-34B, SOLAR-10.7B, Mistral-7B, and Gemma-7B.
1328
+
1329
+ ![Yi-9B benchmark - code](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_code.png?raw=true)
1330
+
1331
+ - In terms of **math** ability (Mean-Math), Yi-9B's performance is second only to DeepSeek-Math-7B, surpassing SOLAR-10.7B, Mistral-7B, and Gemma-7B.
1332
+
1333
+ ![Yi-9B benchmark - math](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_math.png?raw=true)
1334
+
1335
+ - In terms of **common sense and reasoning** ability (Mean-Text), Yi-9B's performance is on par with Mistral-7B, SOLAR-10.7B, and Gemma-7B.
1336
+
1337
+ ![Yi-9B benchmark - text](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_text.png?raw=true)
1338
+
1339
+ <p align="right"> [
1340
+ <a href="#top">Back to top ⬆️ </a> ]
1341
+ </p>
1342
+
1343
+ # Who can use Yi?
1344
+
1345
+ Everyone! 🙌 ✅
1346
+
1347
+ - The Yi series models are free for personal usage, academic purposes, and commercial use. All usage must adhere to the [Yi Series Models Community License Agreement 2.1](https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt)
1348
+
1349
+ - For free commercial use, you only need to [complete this form](https://www.lingyiwanwu.com/yi-license) to get a Yi Model Commercial License.
1350
+
1351
+ <p align="right"> [
1352
+ <a href="#top">Back to top ⬆️ </a> ]
1353
+ </p>
1354
+
1355
+ # Misc.
1356
+
1357
+ ### Acknowledgments
1358
+
1359
+ A heartfelt thank you to each of you who have made contributions to the Yi community! You have helped Yi not just a project, but a vibrant, growing home for innovation.
1360
+
1361
+ [![yi contributors](https://contrib.rocks/image?repo=01-ai/yi&max=2000&columns=15)](https://github.com/01-ai/yi/graphs/contributors)
1362
+
1363
+ <p align="right"> [
1364
+ <a href="#top">Back to top ⬆️ </a> ]
1365
+ </p>
1366
+
1367
+ ### Disclaimer
1368
+
1369
+ We use data compliance checking algorithms during the training process, to
1370
+ ensure the compliance of the trained model to the best of our ability. Due to
1371
+ complex data and the diversity of language model usage scenarios, we cannot
1372
+ guarantee that the model will generate correct, and reasonable output in all
1373
+ scenarios. Please be aware that there is still a risk of the model producing
1374
+ problematic outputs. We will not be responsible for any risks and issues
1375
+ resulting from misuse, misguidance, illegal usage, and related misinformation,
1376
+ as well as any associated data security concerns.
1377
+
1378
+ <p align="right"> [
1379
+ <a href="#top">Back to top ⬆️ </a> ]
1380
+ </p>
1381
+
1382
+ ### License
1383
+
1384
+ The source code in this repo is licensed under the [Apache 2.0
1385
+ license](https://github.com/01-ai/Yi/blob/main/LICENSE). The Yi series models are fully open for academic research and free for commercial use, with automatic permission granted upon application. All usage must adhere to the [Yi Series Models Community License Agreement 2.1](https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt).
1386
+ For free commercial use, you only need to send an email to [get official commercial permission](https://www.lingyiwanwu.com/yi-license).
1387
+
1388
+ <p align="right"> [
1389
+ <a href="#top">Back to top ⬆️ </a> ]
1390
+ </p>
1391
+
1392
+