BenevolenceMessiah commited on
Commit
038b592
β€’
1 Parent(s): 0420fba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +132 -3
README.md CHANGED
@@ -1,3 +1,132 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - 01-ai/Yi-Coder-9B-Chat
4
+ library_name: transformers
5
+ tags:
6
+ - mergekit
7
+ - merge
8
+ license: apache-2.0
9
+ ---
10
+ # merge
11
+
12
+ This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
13
+
14
+ ## Merge Details
15
+ ### Merge Method
16
+
17
+ This model was merged using the [MoE](https://arxiv.org/abs/2306.01708) merge method using [01-ai/Yi-Coder-9B-Chat](https://huggingface.co/01-ai/Yi-Coder-9B-Chat) as a base.
18
+
19
+ ### Models Merged
20
+
21
+ The following models were included in the merge:
22
+ * [01-ai/Yi-Coder-9B-Chat](https://huggingface.co/01-ai/Yi-Coder-9B-Chat)
23
+
24
+ ### Configuration
25
+
26
+ The following YAML configuration was used to produce this model:
27
+
28
+ ```yaml
29
+ base_model: 01-ai/Yi-Coder-9B-Chat
30
+ gate_mode: random
31
+ dtype: bfloat16
32
+ experts:
33
+ - source_model: 01-ai/Yi-Coder-9B-Chat
34
+ - source_model: 01-ai/Yi-Coder-9B-Chat
35
+ - source_model: 01-ai/Yi-Coder-9B-Chat
36
+ - source_model: 01-ai/Yi-Coder-9B-Chat
37
+ - source_model: 01-ai/Yi-Coder-9B-Chat
38
+ - source_model: 01-ai/Yi-Coder-9B-Chat
39
+ - source_model: 01-ai/Yi-Coder-9B-Chat
40
+ - source_model: 01-ai/Yi-Coder-9B-Chat
41
+ ```
42
+ <picture>
43
+ <img src="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg" width="120px">
44
+ </picture>
45
+
46
+ </div>
47
+
48
+ <p align="center">
49
+ <a href="https://github.com/01-ai">πŸ™ GitHub</a> β€’
50
+ <a href="https://discord.gg/hYUwWddeAu">πŸ‘Ύ Discord</a> β€’
51
+ <a href="https://twitter.com/01ai_yi">🐀 Twitter</a> β€’
52
+ <a href="https://github.com/01-ai/Yi-1.5/issues/2">πŸ’¬ WeChat</a>
53
+ <br/>
54
+ <a href="https://arxiv.org/abs/2403.04652">πŸ“ Paper</a> β€’
55
+ <a href="https://01-ai.github.io/">πŸ’ͺ Tech Blog</a> β€’
56
+ <a href="https://github.com/01-ai/Yi/tree/main?tab=readme-ov-file#faq">πŸ™Œ FAQ</a> β€’
57
+ <a href="https://github.com/01-ai/Yi/tree/main?tab=readme-ov-file#learning-hub">πŸ“— Learning Hub</a>
58
+ </p>
59
+
60
+ # Intro
61
+
62
+ 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.
63
+
64
+ Key features:
65
+ - Excelling in long-context understanding with a maximum context length of 128K tokens.
66
+ - Supporting 52 major programming languages:
67
+ ```bash
68
+ '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'
69
+ ```
70
+
71
+ 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).
72
+
73
+ <p align="left">
74
+ <img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/yi-coder-calculator-demo.gif?raw=true" alt="demo1" width="500"/>
75
+ </p>
76
+
77
+ # Models
78
+
79
+ | Name | Type | Length | Download |
80
+ |--------------------|------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
81
+ | 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) |
82
+ | 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) |
83
+ | 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) |
84
+ | 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) |
85
+ | |
86
+
87
+ # Benchmarks
88
+
89
+ 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%.
90
+
91
+ <p align="left">
92
+ <img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/bench1.webp?raw=true" alt="bench1" width="1000"/>
93
+ </p>
94
+
95
+ # Quick Start
96
+
97
+ You can use transformers to run inference with Yi-Coder models (both chat and base versions) as follows:
98
+ ```python
99
+ from transformers import AutoTokenizer, AutoModelForCausalLM
100
+
101
+ device = "cuda" # the device to load the model onto
102
+ model_path = "01-ai/Yi-Coder-9B-Chat"
103
+
104
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
105
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto").eval()
106
+
107
+ prompt = "Write a quick sort algorithm."
108
+ messages = [
109
+ {"role": "system", "content": "You are a helpful assistant."},
110
+ {"role": "user", "content": prompt}
111
+ ]
112
+ text = tokenizer.apply_chat_template(
113
+ messages,
114
+ tokenize=False,
115
+ add_generation_prompt=True
116
+ )
117
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
118
+
119
+ generated_ids = model.generate(
120
+ model_inputs.input_ids,
121
+ max_new_tokens=1024,
122
+ eos_token_id=tokenizer.eos_token_id
123
+ )
124
+ generated_ids = [
125
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
126
+ ]
127
+
128
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
129
+ print(response)
130
+ ```
131
+
132
+ For getting up and running with Yi-Coder series models quickly, see [Yi-Coder