Mia01ai commited on
Commit
619918b
β€’
1 Parent(s): 3891f0b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -3
README.md CHANGED
@@ -1,3 +1,94 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
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, including popular ones such as Java, Python, JavaScript, and C++.
32
+
33
+ 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).
34
+
35
+ <p align="left">
36
+ <img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/demo1.gif?raw=true" alt="demo1" width="500"/>
37
+ </p>
38
+
39
+ # Models
40
+
41
+ | Name | Type | Download |
42
+ |--------------------|------|---------------------------------------------------------------------------------------------------------------------------------------------------|
43
+ | Yi-Coder-9B-Chat | Chat | [πŸ€— 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) |
44
+ | Yi-Coder-1.5B-Chat | Chat | [πŸ€— 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) |
45
+ | Yi-Coder-9B | Base | [πŸ€— 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/) |
46
+ | Yi-Coder-1.5B | Base | [πŸ€— 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) |
47
+ | |
48
+
49
+ # Benchmarks
50
+
51
+ 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%.
52
+
53
+ <p align="left">
54
+ <img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/download1.png?raw=true" alt="download1" width="500"/>
55
+ </p>
56
+
57
+ # Quick Start
58
+
59
+ You can use transformers to run inference with Yi-Coder models (both chat and base versions) as follows:
60
+ ```python
61
+ from transformers import AutoTokenizer, AutoModelForCausalLM
62
+
63
+ device = "cuda" # the device to load the model onto
64
+ model_path = "01-ai/Yi-Coder-9B-Chat"
65
+
66
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
67
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto").eval()
68
+
69
+ prompt = "Write a quick sort algorithm."
70
+ messages = [
71
+ {"role": "system", "content": "You are a helpful assistant."},
72
+ {"role": "user", "content": prompt}
73
+ ]
74
+ text = tokenizer.apply_chat_template(
75
+ messages,
76
+ tokenize=False,
77
+ add_generation_prompt=True
78
+ )
79
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
80
+
81
+ generated_ids = model.generate(
82
+ model_inputs.input_ids,
83
+ max_new_tokens=1024,
84
+ eos_token_id=tokenizer.eos_token_id
85
+ )
86
+ generated_ids = [
87
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
88
+ ]
89
+
90
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
91
+ print(response)
92
+ ```
93
+
94
+ For getting up and running with Yi-Coder series models quickly, see [Yi-Coder README](https://github.com/01-ai/Yi-Coder).