GGUF
RichardErkhov commited on
Commit
0887900
1 Parent(s): 5aeaa5b

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +1345 -0
README.md ADDED
@@ -0,0 +1,1345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GGUF 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-9B-200K - GGUF
11
+ - Model creator: https://huggingface.co/01-ai/
12
+ - Original model: https://huggingface.co/01-ai/Yi-9B-200K/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [Yi-9B-200K.Q2_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q2_K.gguf) | Q2_K | 3.12GB |
18
+ | [Yi-9B-200K.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.IQ3_XS.gguf) | IQ3_XS | 3.46GB |
19
+ | [Yi-9B-200K.IQ3_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.IQ3_S.gguf) | IQ3_S | 3.64GB |
20
+ | [Yi-9B-200K.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q3_K_S.gguf) | Q3_K_S | 3.63GB |
21
+ | [Yi-9B-200K.IQ3_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.IQ3_M.gguf) | IQ3_M | 3.78GB |
22
+ | [Yi-9B-200K.Q3_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q3_K.gguf) | Q3_K | 4.03GB |
23
+ | [Yi-9B-200K.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q3_K_M.gguf) | Q3_K_M | 4.03GB |
24
+ | [Yi-9B-200K.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q3_K_L.gguf) | Q3_K_L | 4.37GB |
25
+ | [Yi-9B-200K.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.IQ4_XS.gguf) | IQ4_XS | 4.5GB |
26
+ | [Yi-9B-200K.Q4_0.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q4_0.gguf) | Q4_0 | 4.69GB |
27
+ | [Yi-9B-200K.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.IQ4_NL.gguf) | IQ4_NL | 4.73GB |
28
+ | [Yi-9B-200K.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q4_K_S.gguf) | Q4_K_S | 4.72GB |
29
+ | [Yi-9B-200K.Q4_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q4_K.gguf) | Q4_K | 4.96GB |
30
+ | [Yi-9B-200K.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q4_K_M.gguf) | Q4_K_M | 4.96GB |
31
+ | [Yi-9B-200K.Q4_1.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q4_1.gguf) | Q4_1 | 5.19GB |
32
+ | [Yi-9B-200K.Q5_0.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q5_0.gguf) | Q5_0 | 5.69GB |
33
+ | [Yi-9B-200K.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q5_K_S.gguf) | Q5_K_S | 5.69GB |
34
+ | [Yi-9B-200K.Q5_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q5_K.gguf) | Q5_K | 5.83GB |
35
+ | [Yi-9B-200K.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q5_K_M.gguf) | Q5_K_M | 5.83GB |
36
+ | [Yi-9B-200K.Q5_1.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q5_1.gguf) | Q5_1 | 6.19GB |
37
+ | [Yi-9B-200K.Q6_K.gguf](https://huggingface.co/RichardErkhov/01-ai_-_Yi-9B-200K-gguf/blob/main/Yi-9B-200K.Q6_K.gguf) | Q6_K | 6.75GB |
38
+
39
+
40
+
41
+ Original model description:
42
+ ---
43
+ license: other
44
+ license_name: yi-license
45
+ license_link: LICENSE
46
+ widget:
47
+ - example_title: "Yi-34B-Chat"
48
+ text: "hi"
49
+ output:
50
+ text: " Hello! How can I assist you today?"
51
+ - example_title: "Yi-34B"
52
+ text: "There's a place where time stands still. A place of breath taking wonder, but also"
53
+ output:
54
+ 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?"
55
+ pipeline_tag: text-generation
56
+ ---
57
+
58
+ <div align="center">
59
+
60
+ <picture>
61
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_dark.svg" width="200px">
62
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg" width="200px">
63
+ <img alt="specify theme context for images" src="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg">
64
+ </picture>
65
+
66
+ </br>
67
+ </br>
68
+
69
+ <div style="display: inline-block;">
70
+ <a href="https://github.com/01-ai/Yi/actions/workflows/build_docker_image.yml">
71
+ <img src="https://github.com/01-ai/Yi/actions/workflows/build_docker_image.yml/badge.svg">
72
+ </a>
73
+ </div>
74
+
75
+ <div style="display: inline-block;">
76
+ <a href="https://github.com/01-ai/Yi/blob/main/LICENSE">
77
+ <img src="https://img.shields.io/badge/Code_License-Apache_2.0-lightblue">
78
+ </a>
79
+ </div>
80
+
81
+ <div style="display: inline-block;">
82
+ <a href="https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt">
83
+ <img src="https://img.shields.io/badge/Model_License-Yi_License-lightblue">
84
+ </a>
85
+ </div>
86
+
87
+ <div style="display: inline-block;">
88
+ <a href="mailto:oss@01.ai">
89
+ <img src="https://img.shields.io/badge/✉️-yi@01.ai-FFE01B">
90
+ </a>
91
+ </div>
92
+
93
+ </div>
94
+
95
+ <div align="center">
96
+ <h3 align="center">Building the Next Generation of Open-Source and Bilingual LLMs</h3>
97
+ </div>
98
+
99
+ <p align="center">
100
+ 🤗 <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>
101
+ </p>
102
+
103
+ <p align="center">
104
+ 👩‍🚀 Ask questions or discuss ideas on <a href="01-ai/Yi · Discussions" target="_blank"> GitHub </a>
105
+ </p>
106
+
107
+ <p align="center">
108
+ 👋 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>
109
+ </p>
110
+
111
+ <p align="center">
112
+ 📝 Check out <a href="https://arxiv.org/abs/2403.04652"> Yi Tech Report </a>
113
+ </p>
114
+
115
+ <p align="center">
116
+ 📚 Grow at <a href="#learning-hub"> Yi Learning Hub </a>
117
+ </p>
118
+
119
+ <!-- DO NOT REMOVE ME -->
120
+
121
+ <hr>
122
+
123
+ <details open>
124
+ <summary></b>📕 Table of Contents</b></summary>
125
+
126
+ - [What is Yi?](#what-is-yi)
127
+ - [Introduction](#introduction)
128
+ - [Models](#models)
129
+ - [Chat models](#chat-models)
130
+ - [Base models](#base-models)
131
+ - [Model info](#model-info)
132
+ - [News](#news)
133
+ - [How to use Yi?](#how-to-use-yi)
134
+ - [Quick start](#quick-start)
135
+ - [Choose your path](#choose-your-path)
136
+ - [pip](#quick-start---pip)
137
+ - [docker](#quick-start---docker)
138
+ - [llama.cpp](#quick-start---llamacpp)
139
+ - [conda-lock](#quick-start---conda-lock)
140
+ - [Web demo](#web-demo)
141
+ - [Fine-tuning](#fine-tuning)
142
+ - [Quantization](#quantization)
143
+ - [Deployment](#deployment)
144
+ - [Learning hub](#learning-hub)
145
+ - [Why Yi?](#why-yi)
146
+ - [Ecosystem](#ecosystem)
147
+ - [Upstream](#upstream)
148
+ - [Downstream](#downstream)
149
+ - [Serving](#serving)
150
+ - [Quantization](#quantization-1)
151
+ - [Fine-tuning](#fine-tuning-1)
152
+ - [API](#api)
153
+ - [Benchmarks](#benchmarks)
154
+ - [Base model performance](#base-model-performance)
155
+ - [Chat model performance](#chat-model-performance)
156
+ - [Tech report](#tech-report)
157
+ - [Citation](#citation)
158
+ - [Who can use Yi?](#who-can-use-yi)
159
+ - [Misc.](#misc)
160
+ - [Acknowledgements](#acknowledgments)
161
+ - [Disclaimer](#disclaimer)
162
+ - [License](#license)
163
+
164
+ </details>
165
+
166
+ <hr>
167
+
168
+ # What is Yi?
169
+
170
+ ## Introduction
171
+
172
+ - 🤖 The Yi series models are the next generation of open-source large language models trained from scratch by [01.AI](https://01.ai/).
173
+
174
+ - 🙌 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,
175
+
176
+ - 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).
177
+
178
+ - 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).
179
+
180
+ - 🙏 (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.
181
+
182
+ <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>
183
+
184
+ > 💡 TL;DR
185
+ >
186
+ > The Yi series models adopt the same model architecture as Llama but are **NOT** derivatives of Llama.
187
+
188
+ - Both Yi and Llama are based on the Transformer structure, which has been the standard architecture for large language models since 2018.
189
+
190
+ - 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.
191
+
192
+ - 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.
193
+
194
+ - However, the Yi series models are NOT derivatives of Llama, as they do not use Llama's weights.
195
+
196
+ - 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.
197
+
198
+ - 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/).
199
+ </ul>
200
+ </details>
201
+
202
+ <p align="right"> [
203
+ <a href="#top">Back to top ⬆️ </a> ]
204
+ </p>
205
+
206
+ ## News
207
+
208
+ <details>
209
+ <summary>🎯 <b>2024-03-16</b>: The <code>Yi-9B-200K</code> is open-sourced and available to the public.</summary>
210
+ </details>
211
+
212
+ <details open>
213
+ <summary>🎯 <b>2024-03-08</b>: <a href="https://arxiv.org/abs/2403.04652">Yi Tech Report</a> is published! </summary>
214
+ </details>
215
+
216
+
217
+ <details open>
218
+ <summary>🔔 <b>2024-03-07</b>: The long text capability of the Yi-34B-200K has been enhanced. </summary>
219
+ <br>
220
+ 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.
221
+ </details>
222
+
223
+ <details open>
224
+ <summary>🎯 <b>2024-03-06</b>: The <code>Yi-9B</code> is open-sourced and available to the public.</summary>
225
+ <br>
226
+ <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.
227
+ </details>
228
+
229
+ <details open>
230
+ <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>
231
+ <br>
232
+ <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>
233
+ </details>
234
+
235
+
236
+ <details>
237
+ <summary>🎯 <b>2023-11-23</b>: <a href="#chat-models">Chat models</a> are open-sourced and available to the public.</summary>
238
+ <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.
239
+
240
+ - `Yi-34B-Chat`
241
+ - `Yi-34B-Chat-4bits`
242
+ - `Yi-34B-Chat-8bits`
243
+ - `Yi-6B-Chat`
244
+ - `Yi-6B-Chat-4bits`
245
+ - `Yi-6B-Chat-8bits`
246
+
247
+ You can try some of them interactively at:
248
+
249
+ - [Hugging Face](https://huggingface.co/spaces/01-ai/Yi-34B-Chat)
250
+ - [Replicate](https://replicate.com/01-ai)
251
+ </details>
252
+
253
+ <details>
254
+ <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>
255
+ </details>
256
+
257
+ <details>
258
+ <summary>🔥 <b>2023-11-08</b>: Invited test of Yi-34B chat model.</summary>
259
+ <br>Application form:
260
+
261
+ - [English](https://cn.mikecrm.com/l91ODJf)
262
+ - [Chinese](https://cn.mikecrm.com/gnEZjiQ)
263
+ </details>
264
+
265
+ <details>
266
+ <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>
267
+ <br>This release contains two base models with the same parameter sizes as the previous
268
+ release, except that the context window is extended to 200K.
269
+ </details>
270
+
271
+ <details>
272
+ <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>
273
+ <br>The first public release contains two bilingual (English/Chinese) base models
274
+ with the parameter sizes of 6B and 34B. Both of them are trained with 4K
275
+ sequence length and can be extended to 32K during inference time.
276
+
277
+ </details>
278
+
279
+ <p align="right"> [
280
+ <a href="#top">Back to top ⬆️ </a> ]
281
+ </p>
282
+
283
+ ## Models
284
+
285
+ Yi models come in multiple sizes and cater to different use cases. You can also fine-tune Yi models to meet your specific requirements.
286
+
287
+ If you want to deploy Yi models, make sure you meet the [software and hardware requirements](#deployment).
288
+
289
+ ### Chat models
290
+
291
+ | Model | Download
292
+ |---|---
293
+ Yi-34B-Chat | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B-Chat) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B-Chat/summary)
294
+ 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)
295
+ 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)
296
+ Yi-6B-Chat| • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B-Chat) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B-Chat/summary)
297
+ 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)
298
+ 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)
299
+
300
+
301
+ <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>
302
+
303
+ ### Base models
304
+
305
+ | Model | Download |
306
+ |---|---|
307
+ Yi-34B| • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B/summary)
308
+ Yi-34B-200K|• [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-34B-200K) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-34B-200K/summary)
309
+ Yi-9B|• [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-9B) • [🤖 ModelScope](https://wisemodel.cn/models/01.AI/Yi-9B)
310
+ Yi-9B-200K | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-9B-200K) • [🤖 ModelScope](https://wisemodel.cn/models/01.AI/Yi-9B-200K)
311
+ Yi-6B| • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B/summary)
312
+ Yi-6B-200K | • [🤗 Hugging Face](https://huggingface.co/01-ai/Yi-6B-200K) • [🤖 ModelScope](https://www.modelscope.cn/models/01ai/Yi-6B-200K/summary)
313
+
314
+ <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>
315
+
316
+ ### Model info
317
+
318
+ - For chat and base models
319
+
320
+ <table>
321
+ <thead>
322
+ <tr>
323
+ <th>Model</th>
324
+ <th>Intro</th>
325
+ <th>Default context window</th>
326
+ <th>Pretrained tokens</th>
327
+ <th>Training Data Date</th>
328
+ </tr>
329
+ </thead>
330
+ <tbody><tr>
331
+ <td>6B series models</td>
332
+ <td>They are suitable for personal and academic use.</td>
333
+ <td rowspan="3">4K</td>
334
+ <td>3T</td>
335
+ <td rowspan="3">Up to June 2023</td>
336
+ </tr>
337
+ <tr>
338
+ <td>9B series models</td>
339
+ <td>It is the best at coding and math in the Yi series models.</td>
340
+ <td>Yi-9B is continuously trained based on Yi-6B, using 0.8T tokens.</td>
341
+ </tr>
342
+ <tr>
343
+ <td>34B series models</td>
344
+ <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>
345
+ <td>3T</td>
346
+ </tr>
347
+ </tbody></table>
348
+
349
+
350
+ - For chat models
351
+
352
+ <details style="display: inline;"><summary>For chat model limitations, see the explanations below. ⬇️</summary>
353
+ <ul>
354
+ <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.
355
+
356
+ <br>However, this higher diversity might amplify certain existing issues, including:
357
+ <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>
358
+ <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>
359
+ <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>
360
+ <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>
361
+ </ul>
362
+ </details>
363
+
364
+ <p align="right"> [
365
+ <a href="#top">Back to top ⬆️ </a> ]
366
+ </p>
367
+
368
+
369
+ # How to use Yi?
370
+
371
+ - [Quick start](#quick-start)
372
+ - [Choose your path](#choose-your-path)
373
+ - [pip](#quick-start---pip)
374
+ - [docker](#quick-start---docker)
375
+ - [conda-lock](#quick-start---conda-lock)
376
+ - [llama.cpp](#quick-start---llamacpp)
377
+ - [Web demo](#web-demo)
378
+ - [Fine-tuning](#fine-tuning)
379
+ - [Quantization](#quantization)
380
+ - [Deployment](#deployment)
381
+ - [Learning hub](#learning-hub)
382
+
383
+ ## Quick start
384
+
385
+ Getting up and running with Yi models is simple with multiple choices available.
386
+
387
+ ### Choose your path
388
+
389
+ Select one of the following paths to begin your journey with Yi!
390
+
391
+ ![Quick start - Choose your path](https://github.com/01-ai/Yi/blob/main/assets/img/quick_start_path.png?raw=true)
392
+
393
+ #### 🎯 Deploy Yi locally
394
+
395
+ If you prefer to deploy Yi models locally,
396
+
397
+ - 🙋‍♀️ and you have **sufficient** resources (for example, NVIDIA A800 80GB), you can choose one of the following methods:
398
+ - [pip](#quick-start---pip)
399
+ - [Docker](#quick-start---docker)
400
+ - [conda-lock](#quick-start---conda-lock)
401
+
402
+ - 🙋‍♀️ and you have **limited** resources (for example, a MacBook Pro), you can use [llama.cpp](#quick-start---llamacpp).
403
+
404
+ #### 🎯 Not to deploy Yi locally
405
+
406
+ If you prefer not to deploy Yi models locally, you can explore Yi's capabilities using any of the following options.
407
+
408
+ ##### 🙋‍♀️ Run Yi with APIs
409
+
410
+ If you want to explore more features of Yi, you can adopt one of these methods:
411
+
412
+ - Yi APIs (Yi official)
413
+ - [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!
414
+
415
+ - [Yi APIs](https://replicate.com/01-ai/yi-34b-chat/api?tab=nodejs) (Replicate)
416
+
417
+ ##### 🙋‍♀️ Run Yi in playground
418
+
419
+ 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:
420
+
421
+ - [Yi-34B-Chat-Playground](https://platform.lingyiwanwu.com/prompt/playground) (Yi official)
422
+ - 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)).
423
+
424
+ - [Yi-34B-Chat-Playground](https://replicate.com/01-ai/yi-34b-chat) (Replicate)
425
+
426
+ ##### 🙋‍♀️ Chat with Yi
427
+
428
+ If you want to chat with Yi, you can use one of these online services, which offer a similar user experience:
429
+
430
+ - [Yi-34B-Chat](https://huggingface.co/spaces/01-ai/Yi-34B-Chat) (Yi official on Hugging Face)
431
+ - No registration is required.
432
+
433
+ - [Yi-34B-Chat](https://platform.lingyiwanwu.com/) (Yi official beta)
434
+ - 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)).
435
+
436
+ <p align="right"> [
437
+ <a href="#top">Back to top ⬆️ </a> ]
438
+ </p>
439
+
440
+ ### Quick start - pip
441
+
442
+ This tutorial guides you through every step of running **Yi-34B-Chat locally on an A800 (80G)** and then performing inference.
443
+
444
+ #### Step 0: Prerequisites
445
+
446
+ - Make sure Python 3.10 or a later version is installed.
447
+
448
+ - If you want to run other Yi models, see [software and hardware requirements](#deployment).
449
+
450
+ #### Step 1: Prepare your environment
451
+
452
+ To set up the environment and install the required packages, execute the following command.
453
+
454
+ ```bash
455
+ git clone https://github.com/01-ai/Yi.git
456
+ cd yi
457
+ pip install -r requirements.txt
458
+ ```
459
+
460
+ #### Step 2: Download the Yi model
461
+
462
+ You can download the weights and tokenizer of Yi models from the following sources:
463
+
464
+ - [Hugging Face](https://huggingface.co/01-ai)
465
+ - [ModelScope](https://www.modelscope.cn/organization/01ai/)
466
+ - [WiseModel](https://wisemodel.cn/organization/01.AI)
467
+
468
+ #### Step 3: Perform inference
469
+
470
+ You can perform inference with Yi chat or base models as below.
471
+
472
+ ##### Perform inference with Yi chat model
473
+
474
+ 1. Create a file named `quick_start.py` and copy the following content to it.
475
+
476
+ ```python
477
+ from transformers import AutoModelForCausalLM, AutoTokenizer
478
+
479
+ model_path = '<your-model-path>'
480
+
481
+ tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
482
+
483
+ # Since transformers 4.35.0, the GPT-Q/AWQ model can be loaded using AutoModelForCausalLM.
484
+ model = AutoModelForCausalLM.from_pretrained(
485
+ model_path,
486
+ device_map="auto",
487
+ torch_dtype='auto'
488
+ ).eval()
489
+
490
+ # Prompt content: "hi"
491
+ messages = [
492
+ {"role": "user", "content": "hi"}
493
+ ]
494
+
495
+ input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
496
+ output_ids = model.generate(input_ids.to('cuda'))
497
+ response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
498
+
499
+ # Model response: "Hello! How can I assist you today?"
500
+ print(response)
501
+ ```
502
+
503
+ 2. Run `quick_start.py`.
504
+
505
+ ```bash
506
+ python quick_start.py
507
+ ```
508
+
509
+ Then you can see an output similar to the one below. 🥳
510
+
511
+ ```bash
512
+ Hello! How can I assist you today?
513
+ ```
514
+
515
+ ##### Perform inference with Yi base model
516
+
517
+ - Yi-34B
518
+
519
+ The steps are similar to [pip - Perform inference with Yi chat model](#perform-inference-with-yi-chat-model).
520
+
521
+ You can use the existing file [`text_generation.py`](https://github.com/01-ai/Yi/tree/main/demo).
522
+
523
+ ```bash
524
+ python demo/text_generation.py --model <your-model-path>
525
+ ```
526
+
527
+ Then you can see an output similar to the one below. 🥳
528
+
529
+ <details>
530
+
531
+ <summary>Output. ⬇️ </summary>
532
+
533
+ <br>
534
+
535
+ **Prompt**: Let me tell you an interesting story about cat Tom and mouse Jerry,
536
+
537
+ **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...
538
+
539
+ </details>
540
+
541
+ - Yi-9B
542
+
543
+ Input
544
+
545
+ ```bash
546
+ from transformers import AutoModelForCausalLM, AutoTokenizer
547
+
548
+ MODEL_DIR = "01-ai/Yi-9B"
549
+ model = AutoModelForCausalLM.from_pretrained(MODEL_DIR, torch_dtype="auto")
550
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR, use_fast=False)
551
+
552
+ input_text = "# write the quick sort algorithm"
553
+ inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
554
+ outputs = model.generate(**inputs, max_length=256)
555
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
556
+ ```
557
+
558
+ Output
559
+
560
+ ```bash
561
+ # write the quick sort algorithm
562
+ def quick_sort(arr):
563
+ if len(arr) <= 1:
564
+ return arr
565
+ pivot = arr[len(arr) // 2]
566
+ left = [x for x in arr if x < pivot]
567
+ middle = [x for x in arr if x == pivot]
568
+ right = [x for x in arr if x > pivot]
569
+ return quick_sort(left) + middle + quick_sort(right)
570
+
571
+ # test the quick sort algorithm
572
+ print(quick_sort([3, 6, 8, 10, 1, 2, 1]))
573
+ ```
574
+
575
+ <p align="right"> [
576
+ <a href="#top">Back to top ⬆️ </a> ]
577
+ </p>
578
+
579
+ ### Quick start - Docker
580
+ <details>
581
+ <summary> Run Yi-34B-chat locally with Docker: a step-by-step guide. ⬇️</summary>
582
+ <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.
583
+ <h4>Step 0: Prerequisites</h4>
584
+ <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>
585
+
586
+ <h4> Step 1: Start Docker </h4>
587
+ <pre><code>docker run -it --gpus all \
588
+ -v &lt;your-model-path&gt;: /models
589
+ ghcr.io/01-ai/yi:latest
590
+ </code></pre>
591
+ <p>Alternatively, you can pull the Yi Docker image from <code>registry.lingyiwanwu.com/ci/01-ai/yi:latest</code>.</p>
592
+
593
+ <h4>Step 2: Perform inference</h4>
594
+ <p>You can perform inference with Yi chat or base models as below.</p>
595
+
596
+ <h5>Perform inference with Yi chat model</h5>
597
+ <p>The steps are similar to <a href="#perform-inference-with-yi-chat-model">pip - Perform inference with Yi chat model</a>.</p>
598
+ <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>
599
+ <h5>Perform inference with Yi base model</h5>
600
+ <p>The steps are similar to <a href="#perform-inference-with-yi-base-model">pip - Perform inference with Yi base model</a>.</p>
601
+ <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>
602
+ </details>
603
+
604
+ ### Quick start - conda-lock
605
+
606
+ <details>
607
+ <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>
608
+ <br>
609
+ 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.
610
+ <br>
611
+ To install the dependencies, follow these steps:
612
+
613
+ 1. Install micromamba by following the instructions available <a href="https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html">here</a>.
614
+
615
+ 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.
616
+ </details>
617
+
618
+
619
+ ### Quick start - llama.cpp
620
+ <details>
621
+ <summary> Run Yi-chat-6B-2bits locally with llama.cpp: a step-by-step guide. ⬇️</summary>
622
+ <br>This tutorial 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>
623
+
624
+ - [Step 0: Prerequisites](#step-0-prerequisites)
625
+ - [Step 1: Download llama.cpp](#step-1-download-llamacpp)
626
+ - [Step 2: Download Yi model](#step-2-download-yi-model)
627
+ - [Step 3: Perform inference](#step-3-perform-inference)
628
+
629
+ #### Step 0: Prerequisites
630
+
631
+ - This tutorial assumes you use a MacBook Pro with 16GB of memory and an Apple M2 Pro chip.
632
+
633
+ - Make sure [`git-lfs`](https://git-lfs.com/) is installed on your machine.
634
+
635
+ #### Step 1: Download `llama.cpp`
636
+
637
+ To clone the [`llama.cpp`](https://github.com/ggerganov/llama.cpp) repository, run the following command.
638
+
639
+ ```bash
640
+ git clone git@github.com:ggerganov/llama.cpp.git
641
+ ```
642
+
643
+ #### Step 2: Download Yi model
644
+
645
+ 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.
646
+
647
+ ```bash
648
+ GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/XeIaso/yi-chat-6B-GGUF
649
+ ```
650
+
651
+ 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.
652
+
653
+ ```bash
654
+ git-lfs pull --include yi-chat-6b.Q2_K.gguf
655
+ ```
656
+
657
+ #### Step 3: Perform inference
658
+
659
+ To perform inference with the Yi model, you can use one of the following methods.
660
+
661
+ - [Method 1: Perform inference in terminal](#method-1-perform-inference-in-terminal)
662
+
663
+ - [Method 2: Perform inference in web](#method-2-perform-inference-in-web)
664
+
665
+ ##### Method 1: Perform inference in terminal
666
+
667
+ To compile `llama.cpp` using 4 threads and then conduct inference, navigate to the `llama.cpp` directory, and run the following command.
668
+
669
+ > ##### Tips
670
+ >
671
+ > - Replace `/Users/yu/yi-chat-6B-GGUF/yi-chat-6b.Q2_K.gguf` with the actual path of your model.
672
+ >
673
+ > - By default, the model operates in completion mode.
674
+ >
675
+ > - For additional output customization options (for example, system prompt, temperature, repetition penalty, etc.), run `./main -h` to check detailed descriptions and usage.
676
+
677
+ ```bash
678
+ 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
679
+
680
+ ...
681
+
682
+ How do you feed your pet fox? Please answer this question in 6 simple steps:
683
+
684
+ 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.
685
+
686
+ 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.
687
+
688
+ 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.
689
+
690
+ 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.
691
+
692
+ 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.
693
+
694
+ 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.
695
+
696
+ ...
697
+
698
+ ```
699
+
700
+ Now you have successfully asked a question to the Yi model and got an answer! 🥳
701
+
702
+ ##### Method 2: Perform inference in web
703
+
704
+ 1. To initialize a lightweight and swift chatbot, run the following command.
705
+
706
+ ```bash
707
+ cd llama.cpp
708
+ ./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
709
+ ```
710
+
711
+ Then you can get an output like this:
712
+
713
+
714
+ ```bash
715
+ ...
716
+
717
+ llama_new_context_with_model: n_ctx = 2048
718
+ llama_new_context_with_model: freq_base = 5000000.0
719
+ llama_new_context_with_model: freq_scale = 1
720
+ ggml_metal_init: allocating
721
+ ggml_metal_init: found device: Apple M2 Pro
722
+ ggml_metal_init: picking default device: Apple M2 Pro
723
+ ggml_metal_init: ggml.metallib not found, loading from source
724
+ ggml_metal_init: GGML_METAL_PATH_RESOURCES = nil
725
+ ggml_metal_init: loading '/Users/yu/llama.cpp/ggml-metal.metal'
726
+ ggml_metal_init: GPU name: Apple M2 Pro
727
+ ggml_metal_init: GPU family: MTLGPUFamilyApple8 (1008)
728
+ ggml_metal_init: hasUnifiedMemory = true
729
+ ggml_metal_init: recommendedMaxWorkingSetSize = 11453.25 MB
730
+ ggml_metal_init: maxTransferRate = built-in GPU
731
+ ggml_backend_metal_buffer_type_alloc_buffer: allocated buffer, size = 128.00 MiB, ( 2629.44 / 10922.67)
732
+ llama_new_context_with_model: KV self size = 128.00 MiB, K (f16): 64.00 MiB, V (f16): 64.00 MiB
733
+ ggml_backend_metal_buffer_type_alloc_buffer: allocated buffer, size = 0.02 MiB, ( 2629.45 / 10922.67)
734
+ llama_build_graph: non-view tensors processed: 676/676
735
+ llama_new_context_with_model: compute buffer total size = 159.19 MiB
736
+ ggml_backend_metal_buffer_type_alloc_buffer: allocated buffer, size = 156.02 MiB, ( 2785.45 / 10922.67)
737
+ Available slots:
738
+ -> Slot 0 - max context: 2048
739
+
740
+ llama server listening at http://0.0.0.0:8080
741
+ ```
742
+
743
+ 2. To access the chatbot interface, open your web browser and enter `http://0.0.0.0:8080` into the address bar.
744
+
745
+ ![Yi model chatbot interface - llama.cpp](https://github.com/01-ai/Yi/blob/main/assets/img/yi_llama_cpp1.png?raw=true)
746
+
747
+
748
+ 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.
749
+
750
+ ![Ask a question to Yi model - llama.cpp](https://github.com/01-ai/Yi/blob/main/assets/img/yi_llama_cpp2.png?raw=true)
751
+
752
+ </ul>
753
+ </details>
754
+
755
+ <p align="right"> [
756
+ <a href="#top">Back to top ⬆️ </a> ]
757
+ </p>
758
+
759
+ ### Web demo
760
+
761
+ You can build a web UI demo for Yi **chat** models (note that Yi base models are not supported in this senario).
762
+
763
+ [Step 1: Prepare your environment](#step-1-prepare-your-environment).
764
+
765
+ [Step 2: Download the Yi model](#step-2-download-the-yi-model).
766
+
767
+ Step 3. To start a web service locally, run the following command.
768
+
769
+ ```bash
770
+ python demo/web_demo.py -c <your-model-path>
771
+ ```
772
+
773
+ You can access the web UI by entering the address provided in the console into your browser.
774
+
775
+ ![Quick start - web demo](https://github.com/01-ai/Yi/blob/main/assets/img/yi_34b_chat_web_demo.gif?raw=true)
776
+
777
+ <p align="right"> [
778
+ <a href="#top">Back to top ⬆️ </a> ]
779
+ </p>
780
+
781
+ ### Fine-tuning
782
+
783
+ ```bash
784
+ bash finetune/scripts/run_sft_Yi_6b.sh
785
+ ```
786
+
787
+ Once finished, you can compare the finetuned model and the base model with the following command:
788
+
789
+ ```bash
790
+ bash finetune/scripts/run_eval.sh
791
+ ```
792
+ <details style="display: inline;"><summary>For advanced usage (like fine-tuning based on your custom data), see the explanations below. ⬇️ </summary> <ul>
793
+
794
+ ### Finetune code for Yi 6B and 34B
795
+
796
+ #### Preparation
797
+
798
+ ##### From Image
799
+
800
+ By default, we use a small dataset from [BAAI/COIG](https://huggingface.co/datasets/BAAI/COIG) to finetune the base model.
801
+ You can also prepare your customized dataset in the following `jsonl` format:
802
+
803
+ ```json
804
+ { "prompt": "Human: Who are you? Assistant:", "chosen": "I'm Yi." }
805
+ ```
806
+
807
+ And then mount them in the container to replace the default ones:
808
+
809
+ ```bash
810
+ docker run -it \
811
+ -v /path/to/save/finetuned/model/:/finetuned-model \
812
+ -v /path/to/train.jsonl:/yi/finetune/data/train.json \
813
+ -v /path/to/eval.jsonl:/yi/finetune/data/eval.json \
814
+ ghcr.io/01-ai/yi:latest \
815
+ bash finetune/scripts/run_sft_Yi_6b.sh
816
+ ```
817
+
818
+ ##### From Local Server
819
+
820
+ Make sure you have conda. If not, use
821
+
822
+ ```bash
823
+ mkdir -p ~/miniconda3
824
+ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
825
+ bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
826
+ rm -rf ~/miniconda3/miniconda.sh
827
+ ~/miniconda3/bin/conda init bash
828
+ source ~/.bashrc
829
+ ```
830
+
831
+ Then, create a conda env:
832
+
833
+ ```bash
834
+ conda create -n dev_env python=3.10 -y
835
+ conda activate dev_env
836
+ pip install torch==2.0.1 deepspeed==0.10 tensorboard transformers datasets sentencepiece accelerate ray==2.7
837
+ ```
838
+
839
+ #### Hardware Setup
840
+
841
+ For the Yi-6B model, a node with 4 GPUs, each with GPU memory larger than 60GB, is recommended.
842
+
843
+ 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).
844
+
845
+ 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.
846
+
847
+ #### Quick Start
848
+
849
+ Download a LLM-base model to MODEL_PATH (6B and 34B). A typical folder of models is like:
850
+
851
+ ```bash
852
+ |-- $MODEL_PATH
853
+ | |-- config.json
854
+ | |-- pytorch_model-00001-of-00002.bin
855
+ | |-- pytorch_model-00002-of-00002.bin
856
+ | |-- pytorch_model.bin.index.json
857
+ | |-- tokenizer_config.json
858
+ | |-- tokenizer.model
859
+ | |-- ...
860
+ ```
861
+
862
+ Download a dataset from huggingface to local storage DATA_PATH, e.g. Dahoas/rm-static.
863
+
864
+ ```bash
865
+ |-- $DATA_PATH
866
+ | |-- data
867
+ | | |-- train-00000-of-00001-2a1df75c6bce91ab.parquet
868
+ | | |-- test-00000-of-00001-8c7c51afc6d45980.parquet
869
+ | |-- dataset_infos.json
870
+ | |-- README.md
871
+ ```
872
+
873
+ `finetune/yi_example_dataset` has example datasets, which are modified from [BAAI/COIG](https://huggingface.co/datasets/BAAI/COIG)
874
+
875
+ ```bash
876
+ |-- $DATA_PATH
877
+ |--data
878
+ |-- train.jsonl
879
+ |-- eval.jsonl
880
+ ```
881
+
882
+ `cd` into the scripts folder, copy and paste the script, and run. For example:
883
+
884
+ ```bash
885
+ cd finetune/scripts
886
+
887
+ bash run_sft_Yi_6b.sh
888
+ ```
889
+
890
+ 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.
891
+
892
+ For the Yi-34B base model, it takes a relatively long time for initialization. Please be patient.
893
+
894
+ #### Evaluation
895
+
896
+ ```bash
897
+ cd finetune/scripts
898
+
899
+ bash run_eval.sh
900
+ ```
901
+
902
+ Then you'll see the answer from both the base model and the finetuned model.
903
+ </ul>
904
+ </details>
905
+
906
+ <p align="right"> [
907
+ <a href="#top">Back to top ⬆️ </a> ]
908
+ </p>
909
+
910
+ ### Quantization
911
+
912
+ #### GPT-Q
913
+ ```bash
914
+ python quantization/gptq/quant_autogptq.py \
915
+ --model /base_model \
916
+ --output_dir /quantized_model \
917
+ --trust_remote_code
918
+ ```
919
+
920
+ Once finished, you can then evaluate the resulting model as follows:
921
+
922
+ ```bash
923
+ python quantization/gptq/eval_quantized_model.py \
924
+ --model /quantized_model \
925
+ --trust_remote_code
926
+ ```
927
+
928
+ <details style="display: inline;"><summary>For details, see the explanations below. ⬇️</summary> <ul>
929
+
930
+ #### GPT-Q quantization
931
+
932
+ [GPT-Q](https://github.com/IST-DASLab/gptq) is a PTQ (Post-Training Quantization)
933
+ method. It saves memory and provides potential speedups while retaining the accuracy
934
+ of the model.
935
+
936
+ Yi models can be GPT-Q quantized without a lot of efforts.
937
+ We provide a step-by-step tutorial below.
938
+
939
+ To run GPT-Q, we will use [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) and
940
+ [exllama](https://github.com/turboderp/exllama).
941
+ And the huggingface transformers has integrated optimum and auto-gptq to perform
942
+ GPTQ quantization on language models.
943
+
944
+ ##### Do Quantization
945
+
946
+ The `quant_autogptq.py` script is provided for you to perform GPT-Q quantization:
947
+
948
+ ```bash
949
+ python quant_autogptq.py --model /base_model \
950
+ --output_dir /quantized_model --bits 4 --group_size 128 --trust_remote_code
951
+ ```
952
+
953
+ ##### Run Quantized Model
954
+
955
+ You can run a quantized model using the `eval_quantized_model.py`:
956
+
957
+ ```bash
958
+ python eval_quantized_model.py --model /quantized_model --trust_remote_code
959
+ ```
960
+ </ul>
961
+ </details>
962
+
963
+ #### AWQ
964
+
965
+ ```bash
966
+ python quantization/awq/quant_autoawq.py \
967
+ --model /base_model \
968
+ --output_dir /quantized_model \
969
+ --trust_remote_code
970
+ ```
971
+
972
+ Once finished, you can then evaluate the resulting model as follows:
973
+
974
+ ```bash
975
+ python quantization/awq/eval_quantized_model.py \
976
+ --model /quantized_model \
977
+ --trust_remote_code
978
+ ```
979
+ <details style="display: inline;"><summary>For details, see the explanations below. ⬇️</summary> <ul>
980
+
981
+ #### AWQ quantization
982
+
983
+ [AWQ](https://github.com/mit-han-lab/llm-awq) is a PTQ (Post-Training Quantization)
984
+ method. It's an efficient and accurate low-bit weight quantization (INT3/4) for LLMs.
985
+
986
+ Yi models can be AWQ quantized without a lot of efforts.
987
+ We provide a step-by-step tutorial below.
988
+
989
+ To run AWQ, we will use [AutoAWQ](https://github.com/casper-hansen/AutoAWQ).
990
+
991
+ ##### Do Quantization
992
+
993
+ The `quant_autoawq.py` script is provided for you to perform AWQ quantization:
994
+
995
+ ```bash
996
+ python quant_autoawq.py --model /base_model \
997
+ --output_dir /quantized_model --bits 4 --group_size 128 --trust_remote_code
998
+ ```
999
+
1000
+ ##### Run Quantized Model
1001
+
1002
+ You can run a quantized model using the `eval_quantized_model.py`:
1003
+
1004
+ ```bash
1005
+ python eval_quantized_model.py --model /quantized_model --trust_remote_code
1006
+ ```
1007
+
1008
+
1009
+ </ul>
1010
+ </details>
1011
+ <p align="right"> [
1012
+ <a href="#top">Back to top ⬆️ </a> ]
1013
+ </p>
1014
+
1015
+ ### Deployment
1016
+
1017
+ If you want to deploy Yi models, make sure you meet the software and hardware requirements.
1018
+
1019
+ #### Software requirements
1020
+
1021
+ Before using Yi quantized models, make sure you've installed the correct software listed below.
1022
+
1023
+ | Model | Software
1024
+ |---|---
1025
+ Yi 4-bit quantized models | [AWQ and CUDA](https://github.com/casper-hansen/AutoAWQ?tab=readme-ov-file#install-from-pypi)
1026
+ Yi 8-bit quantized models | [GPTQ and CUDA](https://github.com/PanQiWei/AutoGPTQ?tab=readme-ov-file#quick-installation)
1027
+
1028
+ #### Hardware requirements
1029
+
1030
+ Before deploying Yi in your environment, make sure your hardware meets the following requirements.
1031
+
1032
+ ##### Chat models
1033
+
1034
+ | Model | Minimum VRAM | Recommended GPU Example |
1035
+ |:----------------------|:--------------|:-------------------------------------:|
1036
+ | 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) |
1037
+ | Yi-6B-Chat-4bits | 4 GB | 1 x RTX 3060 (12 GB)<br> 1 x RTX 4060 (8 GB) |
1038
+ | Yi-6B-Chat-8bits | 8 GB | 1 x RTX 3070 (8 GB) <br> 1 x RTX 4060 (8 GB) |
1039
+ | Yi-34B-Chat | 72 GB | 4 x RTX 4090 (24 GB)<br> 1 x A800 (80GB) |
1040
+ | 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) |
1041
+ | 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) |
1042
+
1043
+ Below are detailed minimum VRAM requirements under different batch use cases.
1044
+
1045
+ | Model | batch=1 | batch=4 | batch=16 | batch=32 |
1046
+ | ----------------------- | ------- | ------- | -------- | -------- |
1047
+ | Yi-6B-Chat | 12 GB | 13 GB | 15 GB | 18 GB |
1048
+ | Yi-6B-Chat-4bits | 4 GB | 5 GB | 7 GB | 10 GB |
1049
+ | Yi-6B-Chat-8bits | 7 GB | 8 GB | 10 GB | 14 GB |
1050
+ | Yi-34B-Chat | 65 GB | 68 GB | 76 GB | > 80 GB |
1051
+ | Yi-34B-Chat-4bits | 19 GB | 20 GB | 30 GB | 40 GB |
1052
+ | Yi-34B-Chat-8bits | 35 GB | 37 GB | 46 GB | 58 GB |
1053
+
1054
+ ##### Base models
1055
+
1056
+ | Model | Minimum VRAM | Recommended GPU Example |
1057
+ |----------------------|--------------|:-------------------------------------:|
1058
+ | 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) |
1059
+ | Yi-6B-200K | 50 GB | 1 x A800 (80 GB) |
1060
+ | Yi-9B | 20 GB | 1 x RTX 4090 (24 GB) |
1061
+ | Yi-34B | 72 GB | 4 x RTX 4090 (24 GB) <br> 1 x A800 (80 GB) |
1062
+ | Yi-34B-200K | 200 GB | 4 x A800 (80 GB) |
1063
+
1064
+ <p align="right"> [
1065
+ <a href="#top">Back to top ⬆️ </a> ]
1066
+ </p>
1067
+
1068
+ ### Learning hub
1069
+
1070
+ <details>
1071
+ <summary> If you want to learn Yi, you can find a wealth of helpful educational resources here. ⬇️</summary>
1072
+ <br>
1073
+
1074
+ Welcome to the Yi learning hub!
1075
+
1076
+ 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.
1077
+
1078
+ 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!
1079
+
1080
+ 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.
1081
+
1082
+ With all these resources at your fingertips, you're ready to start your exciting journey with Yi. Happy learning! 🥳
1083
+
1084
+ #### Tutorials
1085
+
1086
+ ##### English tutorials
1087
+
1088
+ | Type | Deliverable | Date | Author |
1089
+ |-------------|--------------------------------------------------------|----------------|----------------|
1090
+ | 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) |
1091
+ | 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) |
1092
+ | 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) |
1093
+ | 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) |
1094
+
1095
+ ##### Chinese tutorials
1096
+
1097
+ | Type | Deliverable | Date | Author |
1098
+ |-------------|--------------------------------------------------------|----------------|----------------|
1099
+ | Blog | [实测零一万物Yi-VL多模态语言模型:能准确“识图吃瓜”](https://mp.weixin.qq.com/s/fu4O9XvJ03JhimsEyI-SsQ) | 2024-02-02 | [苏洋](https://github.com/soulteary) |
1100
+ | Blog | [本地运行零一万物 34B 大模型,使用 Llama.cpp & 21G 显存](https://zhuanlan.zhihu.com/p/668921042) | 2023-11-26 | [苏洋](https://github.com/soulteary) |
1101
+ | Blog | [零一万物模型折腾笔记:官方 Yi-34B 模型基础使用](https://zhuanlan.zhihu.com/p/671387298) | 2023-12-10 | [苏洋](https://github.com/soulteary) |
1102
+ | Blog | [CPU 混合推理,非常见大模型量化方案:“二三五六” 位量化方案](https://zhuanlan.zhihu.com/p/671698216) | 2023-12-12 | [苏洋](https://github.com/soulteary) |
1103
+ | Blog | [单卡 3 小时训练 Yi-6B 大模型 Agent:基于 Llama Factory 实战](https://zhuanlan.zhihu.com/p/678989191) | 2024-01-22 | [郑耀威](https://github.com/hiyouga) |
1104
+ | Blog | [零一万物开源Yi-VL多模态大模型,魔搭社区推理&微调最佳实践来啦!](https://zhuanlan.zhihu.com/p/680098411) | 2024-01-26 | [ModelScope](https://github.com/modelscope) |
1105
+ | Video | [只需 24G 显存,用 vllm 跑起来 Yi-34B 中英双���大模型](https://www.bilibili.com/video/BV17t4y1f7Ee/) | 2023-12-28 | [漆妮妮](https://space.bilibili.com/1262370256) |
1106
+ | Video | [Yi-VL-34B 多模态大模型 - 用两张 A40 显卡跑起来](https://www.bilibili.com/video/BV1Q5411y7AG/) | 2023-01-28 | [漆妮妮](https://space.bilibili.com/1262370256) |
1107
+
1108
+ </details>
1109
+
1110
+
1111
+ # Why Yi?
1112
+
1113
+ - [Ecosystem](#ecosystem)
1114
+ - [Upstream](#upstream)
1115
+ - [Downstream](#downstream)
1116
+ - [Serving](#serving)
1117
+ - [Quantization](#quantization-1)
1118
+ - [Fine-tuning](#fine-tuning-1)
1119
+ - [API](#api)
1120
+ - [Benchmarks](#benchmarks)
1121
+ - [Chat model performance](#chat-model-performance)
1122
+ - [Base model performance](#base-model-performance)
1123
+ - [Yi-34B and Yi-34B-200K](#yi-34b-and-yi-34b-200k)
1124
+ - [Yi-9B](#yi-9b)
1125
+
1126
+ ## Ecosystem
1127
+
1128
+ Yi has a comprehensive ecosystem, offering a range of tools, services, and models to enrich your experiences and maximize productivity.
1129
+
1130
+ - [Upstream](#upstream)
1131
+ - [Downstream](#downstream)
1132
+ - [Serving](#serving)
1133
+ - [Quantization](#quantization-1)
1134
+ - [Fine-tuning](#fine-tuning-1)
1135
+ - [API](#api)
1136
+
1137
+ ### Upstream
1138
+
1139
+ 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.
1140
+
1141
+ 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).
1142
+
1143
+ ```python
1144
+ from transformers import AutoModelForCausalLM, AutoTokenizer
1145
+
1146
+ tokenizer = AutoTokenizer.from_pretrained("01-ai/Yi-34b", use_fast=False)
1147
+
1148
+ model = AutoModelForCausalLM.from_pretrained("01-ai/Yi-34b", device_map="auto")
1149
+ ```
1150
+
1151
+ <p align="right"> [
1152
+ <a href="#top">Back to top ⬆️ </a> ]
1153
+ </p>
1154
+
1155
+ ### Downstream
1156
+
1157
+ > 💡 Tip
1158
+ >
1159
+ > - Feel free to create a PR and share the fantastic work you've built using the Yi series models.
1160
+ >
1161
+ > - To help others quickly understand your work, it is recommended to use the format of `<model-name>: <model-intro> + <model-highlights>`.
1162
+
1163
+ #### Serving
1164
+
1165
+ If you want to get up with Yi in a few minutes, you can use the following services built upon Yi.
1166
+
1167
+ - Yi-34B-Chat: you can chat with Yi using one of the following platforms:
1168
+ - [Yi-34B-Chat | Hugging Face](https://huggingface.co/spaces/01-ai/Yi-34B-Chat)
1169
+ - [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!
1170
+
1171
+ - [Yi-6B-Chat (Replicate)](https://replicate.com/01-ai): you can use this model with more options by setting additional parameters and calling APIs.
1172
+
1173
+ - [ScaleLLM](https://github.com/vectorch-ai/ScaleLLM#supported-models): you can use this service to run Yi models locally with added flexibility and customization.
1174
+
1175
+ #### Quantization
1176
+
1177
+ If you have limited computational capabilities, you can use Yi's quantized models as follows.
1178
+
1179
+ These quantized models have reduced precision but offer increased efficiency, such as faster inference speed and smaller RAM usage.
1180
+
1181
+ - [TheBloke/Yi-34B-GPTQ](https://huggingface.co/TheBloke/Yi-34B-GPTQ)
1182
+ - [TheBloke/Yi-34B-GGUF](https://huggingface.co/TheBloke/Yi-34B-GGUF)
1183
+ - [TheBloke/Yi-34B-AWQ](https://huggingface.co/TheBloke/Yi-34B-AWQ)
1184
+
1185
+ #### Fine-tuning
1186
+
1187
+ 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.
1188
+
1189
+ - [TheBloke Models](https://huggingface.co/TheBloke): this site hosts numerous fine-tuned models derived from various LLMs including Yi.
1190
+
1191
+ This is not an exhaustive list for Yi, but to name a few sorted on downloads:
1192
+ - [TheBloke/dolphin-2_2-yi-34b-AWQ](https://huggingface.co/TheBloke/dolphin-2_2-yi-34b-AWQ)
1193
+ - [TheBloke/Yi-34B-Chat-AWQ](https://huggingface.co/TheBloke/Yi-34B-Chat-AWQ)
1194
+ - [TheBloke/Yi-34B-Chat-GPTQ](https://huggingface.co/TheBloke/Yi-34B-Chat-GPTQ)
1195
+
1196
+ - [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).
1197
+
1198
+ - [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).
1199
+
1200
+ - [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.
1201
+
1202
+ #### API
1203
+
1204
+ - [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.
1205
+ - [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.
1206
+
1207
+ <p align="right"> [
1208
+ <a href="#top">Back to top ⬆️ </a> ]
1209
+ </p>
1210
+
1211
+ ## Tech report
1212
+
1213
+ For detailed capabilities of the Yi series model, see [Yi: Open Foundation Models by 01.AI](https://arxiv.org/abs/2403.04652).
1214
+
1215
+ ### Citation
1216
+
1217
+ ```
1218
+ @misc{ai2024yi,
1219
+ title={Yi: Open Foundation Models by 01.AI},
1220
+ 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},
1221
+ year={2024},
1222
+ eprint={2403.04652},
1223
+ archivePrefix={arXiv},
1224
+ primaryClass={cs.CL}
1225
+ }
1226
+ ```
1227
+
1228
+ ## Benchmarks
1229
+
1230
+ - [Chat model performance](#chat-model-performance)
1231
+ - [Base model performance](#base-model-performance)
1232
+
1233
+ ### Chat model performance
1234
+
1235
+ 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.
1236
+
1237
+ ![Chat model performance](https://github.com/01-ai/Yi/blob/main/assets/img/benchmark_chat.png?raw=true)
1238
+
1239
+ <details>
1240
+ <summary> Evaluation methods and challenges. ⬇️ </summary>
1241
+
1242
+ - **Evaluation methods**: we evaluated various benchmarks using both zero-shot and few-shot methods, except for TruthfulQA.
1243
+ - **Zero-shot vs. few-shot**: in chat models, the zero-shot approach is more commonly employed.
1244
+ - **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.
1245
+ - **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.
1246
+
1247
+ <strong>*</strong>: C-Eval results are evaluated on the validation datasets
1248
+ </details>
1249
+
1250
+ ### Base model performance
1251
+
1252
+ #### Yi-34B and Yi-34B-200K
1253
+
1254
+ 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.
1255
+
1256
+ ![Base model performance](https://github.com/01-ai/Yi/blob/main/assets/img/benchmark_base.png?raw=true)
1257
+
1258
+ <details>
1259
+ <summary> Evaluation methods. ⬇️</summary>
1260
+
1261
+ - **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.
1262
+ - **Investigation findings**: a deeper investigation reveals that variations in prompts, post-processing strategies, and sampling techniques across models may lead to significant outcome differences.
1263
+ - **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.
1264
+ - **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.
1265
+ - **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.
1266
+ - **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".
1267
+ - **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.
1268
+ </details>
1269
+
1270
+ #### Yi-9B
1271
+
1272
+ 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.
1273
+
1274
+ ![Yi-9B benchmark - details](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_details.png?raw=true)
1275
+
1276
+ - 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.
1277
+
1278
+ ![Yi-9B benchmark - overall](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_overall.png?raw=true)
1279
+
1280
+ - 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.
1281
+
1282
+ ![Yi-9B benchmark - code](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_code.png?raw=true)
1283
+
1284
+ - 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.
1285
+
1286
+ ![Yi-9B benchmark - math](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_math.png?raw=true)
1287
+
1288
+ - 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.
1289
+
1290
+ ![Yi-9B benchmark - text](https://github.com/01-ai/Yi/blob/main/assets/img/Yi-9B_benchmark_text.png?raw=true)
1291
+
1292
+ <p align="right"> [
1293
+ <a href="#top">Back to top ⬆️ </a> ]
1294
+ </p>
1295
+
1296
+ # Who can use Yi?
1297
+
1298
+ Everyone! 🙌 ✅
1299
+
1300
+ - 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)
1301
+
1302
+ - For free commercial use, you only need to [complete this form](https://www.lingyiwanwu.com/yi-license) to get a Yi Model Commercial License.
1303
+
1304
+ <p align="right"> [
1305
+ <a href="#top">Back to top ⬆️ </a> ]
1306
+ </p>
1307
+
1308
+ # Misc.
1309
+
1310
+ ### Acknowledgments
1311
+
1312
+ 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.
1313
+
1314
+ [![yi contributors](https://contrib.rocks/image?repo=01-ai/yi&max=2000&columns=15)](https://github.com/01-ai/yi/graphs/contributors)
1315
+
1316
+ <p align="right"> [
1317
+ <a href="#top">Back to top ⬆️ </a> ]
1318
+ </p>
1319
+
1320
+ ### Disclaimer
1321
+
1322
+ We use data compliance checking algorithms during the training process, to
1323
+ ensure the compliance of the trained model to the best of our ability. Due to
1324
+ complex data and the diversity of language model usage scenarios, we cannot
1325
+ guarantee that the model will generate correct, and reasonable output in all
1326
+ scenarios. Please be aware that there is still a risk of the model producing
1327
+ problematic outputs. We will not be responsible for any risks and issues
1328
+ resulting from misuse, misguidance, illegal usage, and related misinformation,
1329
+ as well as any associated data security concerns.
1330
+
1331
+ <p align="right"> [
1332
+ <a href="#top">Back to top ⬆️ </a> ]
1333
+ </p>
1334
+
1335
+ ### License
1336
+
1337
+ The source code in this repo is licensed under the [Apache 2.0
1338
+ 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).
1339
+ For free commercial use, you only need to send an email to [get official commercial permission](https://www.lingyiwanwu.com/yi-license).
1340
+
1341
+ <p align="right"> [
1342
+ <a href="#top">Back to top ⬆️ </a> ]
1343
+ </p>
1344
+
1345
+