yi-01-ai
commited on
Commit
•
420d59a
1
Parent(s):
03cae8d
Auto Sync from git://github.com/01-ai/Yi.git/commit/e66ad2da797097a6e1e66612d8c1491888f8dd99
Browse files
README.md
CHANGED
@@ -3,39 +3,104 @@ license: other
|
|
3 |
license_name: yi-license
|
4 |
license_link: LICENSE
|
5 |
widget:
|
|
|
6 |
- text: "There's a place where time stands still. A place of breath taking wonder, but also"
|
7 |
output:
|
8 |
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?"
|
9 |
pipeline_tag: text-generation
|
10 |
---
|
|
|
11 |
<div align="center">
|
12 |
|
13 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
</div>
|
16 |
|
17 |
## Introduction
|
18 |
|
19 |
The **Yi** series models are large language models trained from scratch by
|
20 |
-
developers at [01.AI](https://01.ai/).
|
21 |
-
bilingual(English/Chinese) base models with the parameter sizes of 6B([`Yi-6B`](https://huggingface.co/01-ai/Yi-6B))
|
22 |
-
and 34B([`Yi-34B`](https://huggingface.co/01-ai/Yi-34B)). Both of them are trained
|
23 |
-
with 4K sequence length and can be extended to 32K during inference time.
|
24 |
-
The [`Yi-6B-200K`](https://huggingface.co/01-ai/Yi-6B-200K)
|
25 |
-
and [`Yi-34B-200K`](https://huggingface.co/01-ai/Yi-34B-200K) are base model with
|
26 |
-
200K context length.
|
27 |
|
28 |
## News
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
## Model Performance
|
38 |
|
|
|
39 |
| Model | MMLU | CMMLU | C-Eval | GAOKAO | BBH | Common-sense Reasoning | Reading Comprehension | Math & Code |
|
40 |
| :------------ | :------: | :------: | :------: | :------: | :------: | :--------------------: | :-------------------: | :---------: |
|
41 |
| | 5-shot | 5-shot | 5-shot | 0-shot | 3-shot@1 | - | - | - |
|
@@ -77,24 +142,197 @@ Falcon-180B's performance was not underestimated.
|
|
77 |
|
78 |
## Usage
|
79 |
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
## Disclaimer
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
## License
|
95 |
|
96 |
-
The
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
3 |
license_name: yi-license
|
4 |
license_link: LICENSE
|
5 |
widget:
|
6 |
+
- example_title: "Yi-34B"
|
7 |
- text: "There's a place where time stands still. A place of breath taking wonder, but also"
|
8 |
output:
|
9 |
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?"
|
10 |
pipeline_tag: text-generation
|
11 |
---
|
12 |
+
|
13 |
<div align="center">
|
14 |
|
15 |
+
<p align="center">
|
16 |
+
<img width="200px" src="https://github.com/01-ai/Yi/raw/main/assets/img/Yi.svg?sanitize=true">
|
17 |
+
</p>
|
18 |
+
|
19 |
+
<div style="display: inline-block;">
|
20 |
+
<a rel="noopener nofollow" href="https://github.com/01-ai/Yi/issues">
|
21 |
+
<img src="https://img.shields.io/github/issues/01-ai/Yi?logo=github" style="margin: 0 0;">
|
22 |
+
</a>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
<div style="display: inline-block;">
|
26 |
+
<a rel="noopener nofollow" href="https://github.com/01-ai/Yi/actions/workflows/build_docker_image.yml">
|
27 |
+
<img src="https://github.com/01-ai/Yi/actions/workflows/build_docker_image.yml/badge.svg" style="margin: 0 0;">
|
28 |
+
</a>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<div style="display: inline-block;">
|
32 |
+
<a href="https://huggingface.co/01-ai">
|
33 |
+
<img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-01--ai-blue" style="margin: 0 0;">
|
34 |
+
</a>
|
35 |
+
</div>
|
36 |
+
|
37 |
+
<div style="display: inline-block;">
|
38 |
+
<a rel="noopener nofollow" href="https://www.modelscope.cn/organization/01ai/">
|
39 |
+
<img src="https://img.shields.io/badge/ModelScope-01--ai-blue" style="margin: 0 0;">
|
40 |
+
</a>
|
41 |
+
</div>
|
42 |
+
|
43 |
+
<div style="display: inline-block;">
|
44 |
+
<a rel="noopener nofollow" href="https://github.com/01-ai/Yi/blob/main/LICENSE">
|
45 |
+
<img src="https://img.shields.io/badge/Code_License-Apache_2.0-lightblue" style="margin: 0 0;">
|
46 |
+
</a>
|
47 |
+
</div>
|
48 |
+
|
49 |
+
<div style="display: inline-block;">
|
50 |
+
<a rel="noopener nofollow" href="https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt">
|
51 |
+
<img src="https://img.shields.io/badge/Model_License-Model_Agreement-lightblue" style="margin: 0 0;">
|
52 |
+
</a>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<div style="display: inline-block;">
|
56 |
+
<a rel="noopener nofollow" href="mailto:oss@01.ai">
|
57 |
+
<img src="https://img.shields.io/badge/✉️-yi@01.ai-FFE01B" style="margin: 0 0;">
|
58 |
+
</a>
|
59 |
+
</div>
|
60 |
|
61 |
</div>
|
62 |
|
63 |
## Introduction
|
64 |
|
65 |
The **Yi** series models are large language models trained from scratch by
|
66 |
+
developers at [01.AI](https://01.ai/).
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
## News
|
69 |
|
70 |
+
<details open>
|
71 |
+
<summary>🔔 <b>2023/11/15</b>: The commercial licensing agreement for the Yi series models <a href="https://huggingface.co/01-ai/Yi-34B/discussions/28#65546af9198da1df586baaf2">is set to be updated</a>.</summary>
|
72 |
+
</details>
|
73 |
+
|
74 |
+
<details open>
|
75 |
+
<summary>🔥 <b>2023/11/08</b>: Invited test of Yi-34B chat model.</summary>
|
76 |
+
|
77 |
+
Application form:
|
78 |
+
|
79 |
+
- [English](https://cn.mikecrm.com/l91ODJf)
|
80 |
+
- [Chinese](https://cn.mikecrm.com/gnEZjiQ)
|
81 |
|
82 |
+
</details>
|
83 |
+
|
84 |
+
<details>
|
85 |
+
<summary>🎯 <b>2023/11/05</b>: The base model of <code>Yi-6B-200K</code> and <code>Yi-34B-200K</code>.</summary>
|
86 |
+
|
87 |
+
This release contains two base models with the same parameter sizes of previous
|
88 |
+
release, except that the context window is extended to 200K.
|
89 |
+
|
90 |
+
</details>
|
91 |
+
|
92 |
+
<details>
|
93 |
+
<summary>🎯 <b>2023/11/02</b>: The base model of <code>Yi-6B</code> and <code>Yi-34B</code>.</summary>
|
94 |
+
|
95 |
+
The first public release contains two bilingual (English/Chinese) base models
|
96 |
+
with the parameter sizes of 6B and 34B. Both of them are trained with 4K
|
97 |
+
sequence length and can be extended to 32K during inference time.
|
98 |
+
|
99 |
+
</details>
|
100 |
|
101 |
## Model Performance
|
102 |
|
103 |
+
|
104 |
| Model | MMLU | CMMLU | C-Eval | GAOKAO | BBH | Common-sense Reasoning | Reading Comprehension | Math & Code |
|
105 |
| :------------ | :------: | :------: | :------: | :------: | :------: | :--------------------: | :-------------------: | :---------: |
|
106 |
| | 5-shot | 5-shot | 5-shot | 0-shot | 3-shot@1 | - | - | - |
|
|
|
142 |
|
143 |
## Usage
|
144 |
|
145 |
+
Feel free to [create an issue](https://github.com/01-ai/Yi/issues/new) if you
|
146 |
+
encounter any problem when using the **Yi** series models.
|
147 |
+
|
148 |
+
### 1. Prepare development environment
|
149 |
+
|
150 |
+
#### 1.1 Docker
|
151 |
+
The best approach to try the **Yi** series models is through Docker with GPUs. We
|
152 |
+
provide the following docker images to help you get started.
|
153 |
+
|
154 |
+
- `registry.lingyiwanwu.com/ci/01-ai/yi:latest`
|
155 |
+
- `ghcr.io/01-ai/yi:latest`
|
156 |
+
|
157 |
+
Note that the `latest` tag always points to the latest code in the `main`
|
158 |
+
branch. To test a stable version, please replace it with a specific
|
159 |
+
[tag](https://github.com/01-ai/Yi/tags).
|
160 |
+
|
161 |
+
#### 1.2 Local development environment
|
162 |
+
We use [`conda-lock`](https://github.com/conda/conda-lock) to generate fully reproducible lock files for conda environments. You can refer to [conda-lock.yml](./conda-lock.yml) for the exact versions of the dependencies. Additionally, we utilize [`micromamba`](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) for installing these dependencies.
|
163 |
+
|
164 |
+
To install the dependencies, please follow these steps:
|
165 |
+
1. Install `micromamba` by following the instructions available [here](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html).
|
166 |
+
2. Execute `micromamba install -y -n yi -f conda-lock.yml` to create a conda environment named `yi` and install the necessary dependencies.
|
167 |
+
|
168 |
+
### 2. Download the model (optional)
|
169 |
+
|
170 |
+
By default, the model weights and tokenizer will be downloaded from
|
171 |
+
[HuggingFace](https://huggingface.co/01-ai) automatically in the next step. You
|
172 |
+
can also download them manually from the following places:
|
173 |
+
|
174 |
+
- [ModelScope](https://www.modelscope.cn/organization/01ai/)
|
175 |
+
- [WiseModel](https://wisemodel.cn/models) (Search for `Yi`)
|
176 |
+
- Mirror site (remember to extract the content with `tar`)
|
177 |
+
- [Yi-6B.tar](https://storage.lingyiwanwu.com/yi/models/Yi-6B.tar)
|
178 |
+
- [Yi-6B-200K.tar](https://storage.lingyiwanwu.com/yi/models/Yi-6B-200K.tar)
|
179 |
+
- [Yi-34B.tar](https://storage.lingyiwanwu.com/yi/models/Yi-34B.tar)
|
180 |
+
- [Yi-34B-200K.tar](https://storage.lingyiwanwu.com/yi/models/Yi-34B-200K.tar)
|
181 |
+
|
182 |
+
### 3. Examples
|
183 |
+
|
184 |
+
#### 3.1 Use the base model
|
185 |
+
|
186 |
+
```bash
|
187 |
+
python demo/text_generation.py
|
188 |
+
```
|
189 |
+
|
190 |
+
To reuse the downloaded models in the previous step, you can provide the extra
|
191 |
+
`--model` argument:
|
192 |
+
|
193 |
+
```bash
|
194 |
+
python demo/text_generation.py --model /path/to/model
|
195 |
+
```
|
196 |
+
|
197 |
+
Or if you'd like to get your hands dirty:
|
198 |
+
|
199 |
+
```python
|
200 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
201 |
+
|
202 |
+
model = AutoModelForCausalLM.from_pretrained("01-ai/Yi-34B", device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
203 |
+
tokenizer = AutoTokenizer.from_pretrained("01-ai/Yi-34B", trust_remote_code=True)
|
204 |
+
inputs = tokenizer("There's a place where time stands still. A place of breath taking wonder, but also", return_tensors="pt")
|
205 |
+
max_length = 256
|
206 |
+
|
207 |
+
outputs = model.generate(
|
208 |
+
inputs.input_ids.cuda(),
|
209 |
+
max_length=max_length,
|
210 |
+
eos_token_id=tokenizer.eos_token_id,
|
211 |
+
do_sample=True,
|
212 |
+
repetition_penalty=1.3,
|
213 |
+
no_repeat_ngram_size=5,
|
214 |
+
temperature=0.7,
|
215 |
+
top_k=40,
|
216 |
+
top_p=0.8,
|
217 |
+
)
|
218 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
219 |
+
```
|
220 |
+
|
221 |
+
<details>
|
222 |
+
|
223 |
+
<summary>Output</summary>
|
224 |
+
|
225 |
+
**Prompt**: There's a place where time stands still. A place of breath taking wonder, but also
|
226 |
+
|
227 |
+
**Generation**: There's a place where time stands still. A place of breath taking wonder, but also of great danger. A place where the very air you breathe could kill you. A place where the only way to survive is to be prepared.
|
228 |
+
The place is called the Arctic.
|
229 |
+
The Arctic is a vast, frozen wilderness. It is a place of extremes. The temperatures can drop to -40 degrees Celsius. The winds can reach speeds of 100 kilometers per hour. The sun can shine for 24 hours a day, or not at all for weeks on end.
|
230 |
+
The Arctic is also a place of great beauty. The ice and snow are a pristine white. The sky is a deep blue. The sunsets are spectacular.
|
231 |
+
But the Arctic is also a place of great danger. The ice can be treacherous. The winds can be deadly. The sun can be blinding.
|
232 |
+
The Arctic is a place where the only way to survive is to be prepared.
|
233 |
+
The Arctic is a place of extremes. The temperatures can drop to -40 degrees Celsius. The winds can reach speeds of 100 kilometers per hour. The sun can shine for 24 hours a day, or not at all for weeks on end.
|
234 |
+
The Arctic is a place of great beauty. The ice and snow are a
|
235 |
+
|
236 |
+
</details>
|
237 |
+
|
238 |
+
For more advanced usage, please refer to the
|
239 |
+
[doc](https://github.com/01-ai/Yi/tree/main/demo).
|
240 |
+
|
241 |
+
#### 3.2 Finetuning from the base model:
|
242 |
+
|
243 |
+
```bash
|
244 |
+
bash finetune/scripts/run_sft_Yi_6b.sh
|
245 |
+
```
|
246 |
+
|
247 |
+
Once finished, you can compare the finetuned model and the base model with the following command:
|
248 |
+
|
249 |
+
```bash
|
250 |
+
bash finetune/scripts/run_eval.sh
|
251 |
+
```
|
252 |
+
|
253 |
+
For more advanced usage like fine-tuning based on your custom data, please refer
|
254 |
+
the [doc](https://github.com/01-ai/Yi/tree/main/finetune).
|
255 |
+
|
256 |
+
#### 3.3 Quantization
|
257 |
+
|
258 |
+
##### GPT-Q
|
259 |
+
```bash
|
260 |
+
python quantization/gptq/quant_autogptq.py \
|
261 |
+
--model /base_model \
|
262 |
+
--output_dir /quantized_model \
|
263 |
+
--trust_remote_code
|
264 |
+
```
|
265 |
+
|
266 |
+
Once finished, you can then evaluate the resulting model as follows:
|
267 |
+
|
268 |
+
```bash
|
269 |
+
python quantization/gptq/eval_quantized_model.py \
|
270 |
+
--model /quantized_model \
|
271 |
+
--trust_remote_code
|
272 |
+
```
|
273 |
+
|
274 |
+
For a more detailed explanation, please read the [doc](https://github.com/01-ai/Yi/tree/main/quantization/gptq)
|
275 |
+
|
276 |
+
##### AWQ
|
277 |
+
```bash
|
278 |
+
python quantization/awq/quant_autoawq.py \
|
279 |
+
--model /base_model \
|
280 |
+
--output_dir /quantized_model \
|
281 |
+
--trust_remote_code
|
282 |
+
```
|
283 |
+
|
284 |
+
Once finished, you can then evaluate the resulted model as follows:
|
285 |
+
|
286 |
+
```bash
|
287 |
+
python quantization/awq/eval_quantized_model.py \
|
288 |
+
--model /quantized_model \
|
289 |
+
--trust_remote_code
|
290 |
+
```
|
291 |
+
|
292 |
+
For more detailed explanation, please read the [doc](https://github.com/01-ai/Yi/tree/main/quantization/awq)
|
293 |
+
|
294 |
+
## Ecosystem
|
295 |
+
|
296 |
+
🤗 You are encouraged to create a PR and share your awesome work built on top of
|
297 |
+
the Yi series models.
|
298 |
+
|
299 |
+
- Serving
|
300 |
+
- [ScaleLLM](https://github.com/vectorch-ai/ScaleLLM#supported-models): Efficiently run Yi models locally.
|
301 |
+
- Quantization
|
302 |
+
- [TheBloke/Yi-34B-GGUF](https://huggingface.co/TheBloke/Yi-34B-GGUF)
|
303 |
+
- [TheBloke/Yi-34B-GPTQ](https://huggingface.co/TheBloke/Yi-34B-GPTQ)
|
304 |
+
- Finetuning
|
305 |
+
- [NousResearch/Nous-Capybara-34B](https://huggingface.co/NousResearch/Nous-Capybara-34B)
|
306 |
+
|
307 |
+
## FAQ
|
308 |
+
|
309 |
+
1. **Will you release the chat version?**
|
310 |
+
|
311 |
+
Yes, the chat version will be released around the end of November 2023.
|
312 |
+
|
313 |
+
1. **What dataset was this trained with?**
|
314 |
+
|
315 |
+
The dataset we use contains Chinese & English only. We used approximately 3T
|
316 |
+
tokens. The detailed number and its construction will be described in the
|
317 |
+
upcoming technical report.
|
318 |
|
319 |
## Disclaimer
|
320 |
|
321 |
+
We use data compliance checking algorithms during the training process, to
|
322 |
+
ensure the compliance of the trained model to the best of our ability. Due to
|
323 |
+
complex data and the diversity of language model usage scenarios, we cannot
|
324 |
+
guarantee that the model will generate correct, and reasonable output in all
|
325 |
+
scenarios. Please be aware that there is still a risk of the model producing
|
326 |
+
problematic outputs. We will not be responsible for any risks and issues
|
327 |
+
resulting from misuse, misguidance, illegal usage, and related misinformation,
|
328 |
+
as well as any associated data security concerns.
|
329 |
|
330 |
## License
|
331 |
|
332 |
+
The source code in this repo is licensed under the [Apache 2.0
|
333 |
+
license](https://github.com/01-ai/Yi/blob/main/LICENSE). The Yi series models
|
334 |
+
are fully open for academic research and free commercial usage with permission
|
335 |
+
via applications. All usage must adhere to the [Model License
|
336 |
+
Agreement 2.0](https://github.com/01-ai/Yi/blob/main/MODEL_LICENSE_AGREEMENT.txt).
|
337 |
+
To apply for the official commercial license, please contact us
|
338 |
+
([yi@01.ai](mailto:yi@01.ai)).
|