add measurement.json
Browse files- README.md +97 -0
- measurement.json +0 -0
README.md
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
library_name: transformers
|
4 |
+
---
|
5 |
+
<div align="center">
|
6 |
+
|
7 |
+
<picture>
|
8 |
+
<img src="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg" width="120px">
|
9 |
+
</picture>
|
10 |
+
|
11 |
+
</div>
|
12 |
+
|
13 |
+
<p align="center">
|
14 |
+
<a href="https://github.com/01-ai">π GitHub</a> β’
|
15 |
+
<a href="https://discord.gg/hYUwWddeAu">πΎ Discord</a> β’
|
16 |
+
<a href="https://twitter.com/01ai_yi">π€ Twitter</a> β’
|
17 |
+
<a href="https://github.com/01-ai/Yi-1.5/issues/2">π¬ WeChat</a>
|
18 |
+
<br/>
|
19 |
+
<a href="https://arxiv.org/abs/2403.04652">π Paper</a> β’
|
20 |
+
<a href="https://01-ai.github.io/">πͺ Tech Blog</a> β’
|
21 |
+
<a href="https://github.com/01-ai/Yi/tree/main?tab=readme-ov-file#faq">π FAQ</a> β’
|
22 |
+
<a href="https://github.com/01-ai/Yi/tree/main?tab=readme-ov-file#learning-hub">π Learning Hub</a>
|
23 |
+
</p>
|
24 |
+
|
25 |
+
# Intro
|
26 |
+
|
27 |
+
Yi-Coder is a series of open-source code language models that delivers state-of-the-art coding performance with fewer than 10 billion parameters.
|
28 |
+
|
29 |
+
Key features:
|
30 |
+
- Excelling in long-context understanding with a maximum context length of 128K tokens.
|
31 |
+
- Supporting 52 major programming languages:
|
32 |
+
```bash
|
33 |
+
'java', 'markdown', 'python', 'php', 'javascript', 'c++', 'c#', 'c', 'typescript', 'html', 'go', 'java_server_pages', 'dart', 'objective-c', 'kotlin', 'tex', 'swift', 'ruby', 'sql', 'rust', 'css', 'yaml', 'matlab', 'lua', 'json', 'shell', 'visual_basic', 'scala', 'rmarkdown', 'pascal', 'fortran', 'haskell', 'assembly', 'perl', 'julia', 'cmake', 'groovy', 'ocaml', 'powershell', 'elixir', 'clojure', 'makefile', 'coffeescript', 'erlang', 'lisp', 'toml', 'batchfile', 'cobol', 'dockerfile', 'r', 'prolog', 'verilog'
|
34 |
+
```
|
35 |
+
|
36 |
+
For model details and benchmarks, see [Yi-Coder blog](https://01-ai.github.io/) and [Yi-Coder README](https://github.com/01-ai/Yi-Coder).
|
37 |
+
|
38 |
+
<p align="left">
|
39 |
+
<img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/yi-coder-calculator-demo.gif?raw=true" alt="demo1" width="500"/>
|
40 |
+
</p>
|
41 |
+
|
42 |
+
# Models
|
43 |
+
|
44 |
+
| Name | Type | Length | Download |
|
45 |
+
|--------------------|------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
|
46 |
+
| Yi-Coder-9B-Chat | Chat | 128K | [π€ Hugging Face](https://huggingface.co/01-ai/Yi-Coder-9B-Chat) β’ [π€ ModelScope](https://www.modelscope.cn/models/01ai/Yi-Coder-9B-Chat) β’ [π£ wisemodel](https://wisemodel.cn/models/01.AI/Yi-Coder-9B-Chat) |
|
47 |
+
| Yi-Coder-1.5B-Chat | Chat | 128K | [π€ Hugging Face](https://huggingface.co/01-ai/Yi-Coder-1.5B-Chat) β’ [π€ ModelScope](https://www.modelscope.cn/models/01ai/Yi-Coder-1.5B-Chat) β’ [π£ wisemodel](https://wisemodel.cn/models/01.AI/Yi-Coder-1.5B-Chat) |
|
48 |
+
| Yi-Coder-9B | Base | 128K | [π€ Hugging Face](https://huggingface.co/01-ai/Yi-Coder-9B) β’ [π€ ModelScope](https://www.modelscope.cn/models/01ai/Yi-Coder-9B) β’ [π£ wisemodel](https://wisemodel.cn/models/01.AI/Yi-Coder-9B) |
|
49 |
+
| Yi-Coder-1.5B | Base | 128K | [π€ Hugging Face](https://huggingface.co/01-ai/Yi-Coder-1.5B) β’ [π€ ModelScope](https://www.modelscope.cn/models/01ai/Yi-Coder-1.5B) β’ [π£ wisemodel](https://wisemodel.cn/models/01.AI/Yi-Coder-1.5B) |
|
50 |
+
| |
|
51 |
+
|
52 |
+
# Benchmarks
|
53 |
+
|
54 |
+
As illustrated in the figure below, Yi-Coder-9B-Chat achieved an impressive 23% pass rate in LiveCodeBench, making it the only model with under 10B parameters to surpass 20%. It also outperforms DeepSeekCoder-33B-Ins at 22.3%, CodeGeex4-9B-all at 17.8%, CodeLLama-34B-Ins at 13.3%, and CodeQwen1.5-7B-Chat at 12%.
|
55 |
+
|
56 |
+
<p align="left">
|
57 |
+
<img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/bench1.webp?raw=true" alt="bench1" width="1000"/>
|
58 |
+
</p>
|
59 |
+
|
60 |
+
# Quick Start
|
61 |
+
|
62 |
+
You can use transformers to run inference with Yi-Coder models (both chat and base versions) as follows:
|
63 |
+
```python
|
64 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
65 |
+
|
66 |
+
device = "cuda" # the device to load the model onto
|
67 |
+
model_path = "01-ai/Yi-Coder-9B-Chat"
|
68 |
+
|
69 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
70 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto").eval()
|
71 |
+
|
72 |
+
prompt = "Write a quick sort algorithm."
|
73 |
+
messages = [
|
74 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
75 |
+
{"role": "user", "content": prompt}
|
76 |
+
]
|
77 |
+
text = tokenizer.apply_chat_template(
|
78 |
+
messages,
|
79 |
+
tokenize=False,
|
80 |
+
add_generation_prompt=True
|
81 |
+
)
|
82 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
83 |
+
|
84 |
+
generated_ids = model.generate(
|
85 |
+
model_inputs.input_ids,
|
86 |
+
max_new_tokens=1024,
|
87 |
+
eos_token_id=tokenizer.eos_token_id
|
88 |
+
)
|
89 |
+
generated_ids = [
|
90 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
91 |
+
]
|
92 |
+
|
93 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
94 |
+
print(response)
|
95 |
+
```
|
96 |
+
|
97 |
+
For getting up and running with Yi-Coder series models quickly, see [Yi-Coder README](https://github.com/01-ai/Yi-Coder).
|
measurement.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|