Upload 13 files
Browse files- .gitattributes +12 -0
- README.md +305 -3
- Yi-Coder-9B-Chat.IQ1_M.gguf +3 -0
- Yi-Coder-9B-Chat.IQ1_S.gguf +3 -0
- Yi-Coder-9B-Chat.IQ2_M.gguf +3 -0
- Yi-Coder-9B-Chat.IQ2_S.gguf +3 -0
- Yi-Coder-9B-Chat.IQ2_XS.gguf +3 -0
- Yi-Coder-9B-Chat.IQ2_XXS.gguf +3 -0
- Yi-Coder-9B-Chat.IQ3_M.gguf +3 -0
- Yi-Coder-9B-Chat.IQ3_S.gguf +3 -0
- Yi-Coder-9B-Chat.IQ3_XS.gguf +3 -0
- Yi-Coder-9B-Chat.IQ3_XXS.gguf +3 -0
- Yi-Coder-9B-Chat.IQ4_XS.gguf +3 -0
- Yi-Coder-9B-Chat.imatrix.dat +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,15 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
Yi-Coder-9B-Chat.imatrix.dat filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Yi-Coder-9B-Chat.IQ1_M.gguf filter=lfs diff=lfs merge=lfs -text
|
38 |
+
Yi-Coder-9B-Chat.IQ1_S.gguf filter=lfs diff=lfs merge=lfs -text
|
39 |
+
Yi-Coder-9B-Chat.IQ2_M.gguf filter=lfs diff=lfs merge=lfs -text
|
40 |
+
Yi-Coder-9B-Chat.IQ2_S.gguf filter=lfs diff=lfs merge=lfs -text
|
41 |
+
Yi-Coder-9B-Chat.IQ2_XS.gguf filter=lfs diff=lfs merge=lfs -text
|
42 |
+
Yi-Coder-9B-Chat.IQ2_XXS.gguf filter=lfs diff=lfs merge=lfs -text
|
43 |
+
Yi-Coder-9B-Chat.IQ3_M.gguf filter=lfs diff=lfs merge=lfs -text
|
44 |
+
Yi-Coder-9B-Chat.IQ3_S.gguf filter=lfs diff=lfs merge=lfs -text
|
45 |
+
Yi-Coder-9B-Chat.IQ3_XS.gguf filter=lfs diff=lfs merge=lfs -text
|
46 |
+
Yi-Coder-9B-Chat.IQ3_XXS.gguf filter=lfs diff=lfs merge=lfs -text
|
47 |
+
Yi-Coder-9B-Chat.IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,305 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- code
|
5 |
+
language:
|
6 |
+
- code
|
7 |
+
base_model: 01-ai/Yi-Coder-9B-Chat
|
8 |
+
model_creator: 01.AI
|
9 |
+
model_name: Yi-Coder-9B-Chat
|
10 |
+
model_type: llama
|
11 |
+
datasets:
|
12 |
+
- m-a-p/CodeFeedback-Filtered-Instruction
|
13 |
+
quantized_by: CISC
|
14 |
+
---
|
15 |
+
|
16 |
+
# Yi-Coder-9B-Chat - SOTA GGUF
|
17 |
+
- Model creator: [01.AI](https://huggingface.co/01-ai)
|
18 |
+
- Original model: [Yi-Coder-9B-Chat](https://huggingface.co/01-ai/Yi-Coder-9B-Chat)
|
19 |
+
|
20 |
+
<!-- description start -->
|
21 |
+
## Description
|
22 |
+
|
23 |
+
This repo contains State Of The Art quantized GGUF format model files for [Yi-Coder-9B-Chat](https://huggingface.co/01-ai/Yi-Coder-9B-Chat).
|
24 |
+
|
25 |
+
Quantization was done with an importance matrix that was trained for ~1M tokens (256 batches of 4096 tokens) of answers from the [CodeFeedback-Filtered-Instruction](https://huggingface.co/datasets/m-a-p/CodeFeedback-Filtered-Instruction) dataset.
|
26 |
+
|
27 |
+
Corrected EOS (<|im_end|>) and added EOT (<|endoftext|>) token to prevent infinite responses (am I the only one actually dog-fooding my own quants?).
|
28 |
+
|
29 |
+
Fill-in-Middle token metadata has been added, see [example](#simple-llama-cpp-python-example-fill-in-middle-code). NOTE: Yi's FIM requires support for [SPM infill mode](https://github.com/abetlen/llama-cpp-python/pull/1492)! However it seems it has not been extensively trained for this (perhaps not at all), so don't expect particularly great results...
|
30 |
+
|
31 |
+
<!-- description end -->
|
32 |
+
|
33 |
+
|
34 |
+
<!-- prompt-template start -->
|
35 |
+
## Prompt template: ChatML
|
36 |
+
|
37 |
+
```
|
38 |
+
<|im_start|>system
|
39 |
+
{system_prompt}<|im_end|>
|
40 |
+
<|im_start|>user
|
41 |
+
{prompt}<|im_end|>
|
42 |
+
<|im_start|>assistant
|
43 |
+
```
|
44 |
+
|
45 |
+
<!-- prompt-template end -->
|
46 |
+
|
47 |
+
|
48 |
+
<!-- compatibility_gguf start -->
|
49 |
+
## Compatibility
|
50 |
+
|
51 |
+
These quantised GGUFv3 files are compatible with llama.cpp from February 27th 2024 onwards, as of commit [0becb22](https://github.com/ggerganov/llama.cpp/commit/0becb22ac05b6542bd9d5f2235691aa1d3d4d307)
|
52 |
+
|
53 |
+
They are also compatible with many third party UIs and libraries provided they are built using a recent llama.cpp.
|
54 |
+
|
55 |
+
## Explanation of quantisation methods
|
56 |
+
|
57 |
+
<details>
|
58 |
+
<summary>Click to see details</summary>
|
59 |
+
|
60 |
+
The new methods available are:
|
61 |
+
|
62 |
+
* GGML_TYPE_IQ1_S - 1-bit quantization in super-blocks with an importance matrix applied, effectively using 1.56 bits per weight (bpw)
|
63 |
+
* GGML_TYPE_IQ1_M - 1-bit quantization in super-blocks with an importance matrix applied, effectively using 1.75 bpw
|
64 |
+
* GGML_TYPE_IQ2_XXS - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.06 bpw
|
65 |
+
* GGML_TYPE_IQ2_XS - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.31 bpw
|
66 |
+
* GGML_TYPE_IQ2_S - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.5 bpw
|
67 |
+
* GGML_TYPE_IQ2_M - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.7 bpw
|
68 |
+
* GGML_TYPE_IQ3_XXS - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.06 bpw
|
69 |
+
* GGML_TYPE_IQ3_XS - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.3 bpw
|
70 |
+
* GGML_TYPE_IQ3_S - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.44 bpw
|
71 |
+
* GGML_TYPE_IQ3_M - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.66 bpw
|
72 |
+
* GGML_TYPE_IQ4_XS - 4-bit quantization in super-blocks with an importance matrix applied, effectively using 4.25 bpw
|
73 |
+
* GGML_TYPE_IQ4_NL - 4-bit non-linearly mapped quantization with an importance matrix applied, effectively using 4.5 bpw
|
74 |
+
|
75 |
+
Refer to the Provided Files table below to see what files use which methods, and how.
|
76 |
+
</details>
|
77 |
+
<!-- compatibility_gguf end -->
|
78 |
+
|
79 |
+
<!-- README_GGUF.md-provided-files start -->
|
80 |
+
## Provided files
|
81 |
+
|
82 |
+
| Name | Quant method | Bits | Size | Max RAM required | Use case |
|
83 |
+
| ---- | ---- | ---- | ---- | ---- | ----- |
|
84 |
+
| [Yi-Coder-9B-Chat.IQ1_S.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ1_S.gguf) | IQ1_S | 1 | 1.9 GB| 2.2 GB | smallest, significant quality loss |
|
85 |
+
| [Yi-Coder-9B-Chat.IQ1_M.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ1_M.gguf) | IQ1_M | 1 | 2.0 GB| 2.3 GB | very small, significant quality loss |
|
86 |
+
| [Yi-Coder-9B-Chat.IQ2_XXS.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ2_XXS.gguf) | IQ2_XXS | 2 | 2.3 GB| 2.6 GB | very small, high quality loss |
|
87 |
+
| [Yi-Coder-9B-Chat.IQ2_XS.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ2_XS.gguf) | IQ2_XS | 2 | 2.5 GB| 2.8 GB | very small, high quality loss |
|
88 |
+
| [Yi-Coder-9B-Chat.IQ2_S.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ2_S.gguf) | IQ2_S | 2 | 2.7 GB| 2.9 GB | small, substantial quality loss |
|
89 |
+
| [Yi-Coder-9B-Chat.IQ2_M.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ2_M.gguf) | IQ2_M | 2 | 2.9 GB| 3.1 GB | small, greater quality loss |
|
90 |
+
| [Yi-Coder-9B-Chat.IQ3_XXS.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ3_XXS.gguf) | IQ3_XXS | 3 | 3.2 GB| 3.5 GB | very small, high quality loss |
|
91 |
+
| [Yi-Coder-9B-Chat.IQ3_XS.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ3_XS.gguf) | IQ3_XS | 3 | 3.5 GB| 3.8 GB | small, substantial quality loss |
|
92 |
+
| [Yi-Coder-9B-Chat.IQ3_S.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ3_S.gguf) | IQ3_S | 3 | 3.6 GB| 3.9 GB | small, greater quality loss |
|
93 |
+
| [Yi-Coder-9B-Chat.IQ3_M.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ3_M.gguf) | IQ3_M | 3 | 3.8 GB| 4.1 GB | medium, balanced quality - recommended |
|
94 |
+
| [Yi-Coder-9B-Chat.IQ4_XS.gguf](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.IQ4_XS.gguf) | IQ4_XS | 4 | 4.5 GB| 4.7 GB | small, substantial quality loss |
|
95 |
+
|
96 |
+
Generated importance matrix file: [Yi-Coder-9B-Chat.imatrix.dat](https://huggingface.co/CISCai/Yi-Coder-9B-Chat-SOTA-GGUF/blob/main/Yi-Coder-9B-Chat.imatrix.dat)
|
97 |
+
|
98 |
+
**Note**: the above RAM figures assume no GPU offloading with 4K context. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
|
99 |
+
|
100 |
+
<!-- README_GGUF.md-provided-files end -->
|
101 |
+
|
102 |
+
<!-- README_GGUF.md-how-to-run start -->
|
103 |
+
## Example `llama.cpp` command
|
104 |
+
|
105 |
+
Make sure you are using `llama.cpp` from commit [0becb22](https://github.com/ggerganov/llama.cpp/commit/0becb22ac05b6542bd9d5f2235691aa1d3d4d307) or later.
|
106 |
+
|
107 |
+
```shell
|
108 |
+
./llama-cli -ngl 49 -m Yi-Coder-9B-Chat.IQ4_XS.gguf --color -c 131072 --temp 0 --repeat-penalty 1.1 -p "<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
|
109 |
+
```
|
110 |
+
|
111 |
+
Change `-ngl 49` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
112 |
+
|
113 |
+
Change `-c 131072` to the desired sequence length.
|
114 |
+
|
115 |
+
If you are low on V/RAM try quantizing the K-cache with `-ctk q8_0` or even `-ctk q4_0` for big memory savings (depending on context size).
|
116 |
+
There is a similar option for V-cache (`-ctv`), only available if you enable Flash Attention (`-fa`) as well.
|
117 |
+
|
118 |
+
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
119 |
+
|
120 |
+
## How to run from Python code
|
121 |
+
|
122 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) module.
|
123 |
+
|
124 |
+
### How to load this model in Python code, using llama-cpp-python
|
125 |
+
|
126 |
+
For full documentation, please see: [llama-cpp-python docs](https://llama-cpp-python.readthedocs.io/en/latest/).
|
127 |
+
|
128 |
+
#### First install the package
|
129 |
+
|
130 |
+
Run one of the following commands, according to your system:
|
131 |
+
|
132 |
+
```shell
|
133 |
+
# Prebuilt wheel with basic CPU support
|
134 |
+
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
135 |
+
# Prebuilt wheel with NVidia CUDA acceleration
|
136 |
+
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121 (or cu122 etc.)
|
137 |
+
# Prebuilt wheel with Metal GPU acceleration
|
138 |
+
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/metal
|
139 |
+
# Build base version with no GPU acceleration
|
140 |
+
pip install llama-cpp-python
|
141 |
+
# With NVidia CUDA acceleration
|
142 |
+
CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python
|
143 |
+
# Or with OpenBLAS acceleration
|
144 |
+
CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
|
145 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
146 |
+
CMAKE_ARGS="-DGGML_HIPBLAS=on" pip install llama-cpp-python
|
147 |
+
# Or with Metal GPU acceleration for macOS systems only
|
148 |
+
CMAKE_ARGS="-DGGML_METAL=on" pip install llama-cpp-python
|
149 |
+
# Or with Vulkan acceleration
|
150 |
+
CMAKE_ARGS="-DGGML_VULKAN=on" pip install llama-cpp-python
|
151 |
+
# Or with SYCL acceleration
|
152 |
+
CMAKE_ARGS="-DGGML_SYCL=on -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx" pip install llama-cpp-python
|
153 |
+
|
154 |
+
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
|
155 |
+
$env:CMAKE_ARGS = "-DGGML_CUDA=on"
|
156 |
+
pip install llama-cpp-python
|
157 |
+
```
|
158 |
+
|
159 |
+
#### Simple llama-cpp-python example code
|
160 |
+
|
161 |
+
```python
|
162 |
+
from llama_cpp import Llama
|
163 |
+
|
164 |
+
# Chat Completion API
|
165 |
+
|
166 |
+
llm = Llama(model_path="./Yi-Coder-9B-Chat.IQ4_XS.gguf", n_gpu_layers=49, n_ctx=131072)
|
167 |
+
print(llm.create_chat_completion(
|
168 |
+
repeat_penalty = 1.1,
|
169 |
+
messages = [
|
170 |
+
{
|
171 |
+
"role": "user",
|
172 |
+
"content": "Pick a LeetCode challenge and solve it in Python."
|
173 |
+
}
|
174 |
+
]
|
175 |
+
))
|
176 |
+
```
|
177 |
+
|
178 |
+
#### Simple llama-cpp-python example fill-in-middle code
|
179 |
+
|
180 |
+
```python
|
181 |
+
from llama_cpp import Llama
|
182 |
+
|
183 |
+
# Completion API
|
184 |
+
|
185 |
+
prompt = "def add("
|
186 |
+
suffix = "\n return sum\n\n"
|
187 |
+
|
188 |
+
llm = Llama(model_path="./Yi-Coder-9B-Chat.IQ4_XS.gguf", n_gpu_layers=49, n_ctx=131072, spm_infill=True)
|
189 |
+
output = llm.create_completion(
|
190 |
+
temperature = 0.0,
|
191 |
+
repeat_penalty = 1.0,
|
192 |
+
prompt = prompt,
|
193 |
+
suffix = suffix
|
194 |
+
)
|
195 |
+
|
196 |
+
# Models sometimes repeat suffix in response, attempt to filter that
|
197 |
+
response = output["choices"][0]["text"]
|
198 |
+
response_stripped = response.rstrip()
|
199 |
+
unwanted_response_suffix = suffix.rstrip()
|
200 |
+
unwanted_response_length = len(unwanted_response_suffix)
|
201 |
+
|
202 |
+
filtered = False
|
203 |
+
if unwanted_response_suffix and response_stripped[-unwanted_response_length:] == unwanted_response_suffix:
|
204 |
+
response = response_stripped[:-unwanted_response_length]
|
205 |
+
filtered = True
|
206 |
+
|
207 |
+
print(f"Fill-in-Middle completion{' (filtered)' if filtered else ''}:\n\n{prompt}\033[32m{response}\033[{'33' if filtered else '0'}m{suffix}\033[0m")
|
208 |
+
```
|
209 |
+
|
210 |
+
<!-- README_GGUF.md-how-to-run end -->
|
211 |
+
|
212 |
+
<!-- original-model-card start -->
|
213 |
+
<div align="center">
|
214 |
+
|
215 |
+
<picture>
|
216 |
+
<img src="https://raw.githubusercontent.com/01-ai/Yi/main/assets/img/Yi_logo_icon_light.svg" width="120px">
|
217 |
+
</picture>
|
218 |
+
|
219 |
+
</div>
|
220 |
+
|
221 |
+
<p align="center">
|
222 |
+
<a href="https://github.com/01-ai">🐙 GitHub</a> •
|
223 |
+
<a href="https://discord.gg/hYUwWddeAu">👾 Discord</a> •
|
224 |
+
<a href="https://twitter.com/01ai_yi">🐤 Twitter</a> •
|
225 |
+
<a href="https://github.com/01-ai/Yi-1.5/issues/2">💬 WeChat</a>
|
226 |
+
<br/>
|
227 |
+
<a href="https://arxiv.org/abs/2403.04652">📝 Paper</a> •
|
228 |
+
<a href="https://01-ai.github.io/">💪 Tech Blog</a> •
|
229 |
+
<a href="https://github.com/01-ai/Yi/tree/main?tab=readme-ov-file#faq">🙌 FAQ</a> •
|
230 |
+
<a href="https://github.com/01-ai/Yi/tree/main?tab=readme-ov-file#learning-hub">📗 Learning Hub</a>
|
231 |
+
</p>
|
232 |
+
|
233 |
+
# Intro
|
234 |
+
|
235 |
+
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.
|
236 |
+
|
237 |
+
Key features:
|
238 |
+
- Excelling in long-context understanding with a maximum context length of 128K tokens.
|
239 |
+
- Supporting 52 major programming languages:
|
240 |
+
```bash
|
241 |
+
'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'
|
242 |
+
```
|
243 |
+
|
244 |
+
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).
|
245 |
+
|
246 |
+
<p align="left">
|
247 |
+
<img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/yi-coder-calculator-demo.gif?raw=true" alt="demo1" width="500"/>
|
248 |
+
</p>
|
249 |
+
|
250 |
+
# Models
|
251 |
+
|
252 |
+
| Name | Type | Length | Download |
|
253 |
+
|--------------------|------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
|
254 |
+
| 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) |
|
255 |
+
| 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) |
|
256 |
+
| 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) |
|
257 |
+
| 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) |
|
258 |
+
| |
|
259 |
+
|
260 |
+
# Benchmarks
|
261 |
+
|
262 |
+
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%.
|
263 |
+
|
264 |
+
<p align="left">
|
265 |
+
<img src="https://github.com/01-ai/Yi/blob/main/assets/img/coder/bench1.webp?raw=true" alt="bench1" width="1000"/>
|
266 |
+
</p>
|
267 |
+
|
268 |
+
# Quick Start
|
269 |
+
|
270 |
+
You can use transformers to run inference with Yi-Coder models (both chat and base versions) as follows:
|
271 |
+
```python
|
272 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
273 |
+
|
274 |
+
device = "cuda" # the device to load the model onto
|
275 |
+
model_path = "01-ai/Yi-Coder-9B-Chat"
|
276 |
+
|
277 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
278 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto").eval()
|
279 |
+
|
280 |
+
prompt = "Write a quick sort algorithm."
|
281 |
+
messages = [
|
282 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
283 |
+
{"role": "user", "content": prompt}
|
284 |
+
]
|
285 |
+
text = tokenizer.apply_chat_template(
|
286 |
+
messages,
|
287 |
+
tokenize=False,
|
288 |
+
add_generation_prompt=True
|
289 |
+
)
|
290 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
291 |
+
|
292 |
+
generated_ids = model.generate(
|
293 |
+
model_inputs.input_ids,
|
294 |
+
max_new_tokens=1024,
|
295 |
+
eos_token_id=tokenizer.eos_token_id
|
296 |
+
)
|
297 |
+
generated_ids = [
|
298 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
299 |
+
]
|
300 |
+
|
301 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
302 |
+
print(response)
|
303 |
+
```
|
304 |
+
|
305 |
+
For getting up and running with Yi-Coder series models quickly, see [Yi-Coder README](https://github.com/01-ai/Yi-Coder).
|
Yi-Coder-9B-Chat.IQ1_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b78d928608b990ce33db54e7bc3ccc2a0cd8d40d2e9377ac0960eff418bb9f4f
|
3 |
+
size 2181641152
|
Yi-Coder-9B-Chat.IQ1_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:85936d853fa60593df331adb589a87c402ea7fa5f933025a393b3c294b357b34
|
3 |
+
size 2014573504
|
Yi-Coder-9B-Chat.IQ2_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:14343048726c07cd0bd77afadb5005b2a65979129f6030af8ef0d1eb76051ba8
|
3 |
+
size 3098112960
|
Yi-Coder-9B-Chat.IQ2_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c689d7fa1ebd6e2c142befbce70d457245335c085b082ba872b493caefad69db
|
3 |
+
size 2875356096
|
Yi-Coder-9B-Chat.IQ2_XS.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:02bbac077b8b7dce2e44b9de3db8f76d892aa7d3364d910e502e9093a183d89b
|
3 |
+
size 2708009920
|
Yi-Coder-9B-Chat.IQ2_XXS.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:888f6e659a9a28b4752c94f03b77602fb0a400b36084fba768eb89b8196e2f09
|
3 |
+
size 2460087232
|
Yi-Coder-9B-Chat.IQ3_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0588f4e66af2cfd0dc778a885d7684cf340d52641255f2bcf328be34059b56eb
|
3 |
+
size 4055462848
|
Yi-Coder-9B-Chat.IQ3_S.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:551872b6ea7c83a9251b8cff65e36019b3d7ed3ec5f6d02535fc8b497dedb0ed
|
3 |
+
size 3912577984
|
Yi-Coder-9B-Chat.IQ3_XS.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:490a0fb256cfbeee1657dc01b37edee880c3e0d97a75f25af53cd0a8637a806b
|
3 |
+
size 3717936064
|
Yi-Coder-9B-Chat.IQ3_XXS.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7eb5101bc603af9e6bf1dc6c5c3bdb465af4652ab3506d405fbfe6def1b2b3a2
|
3 |
+
size 3474322368
|
Yi-Coder-9B-Chat.IQ4_XS.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed52436d62c1f25250b1914dd73ea4e8db247ed2752be0245aee6d412133b73d
|
3 |
+
size 4785009600
|
Yi-Coder-9B-Chat.imatrix.dat
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:90f8ed0f6830f6deb8dbf36baa781cacfa01e4261ac9ac69c0373613fa7345e2
|
3 |
+
size 6843280
|