RichardErkhov commited on
Commit
c32d836
1 Parent(s): 82b93a7

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +257 -0
README.md ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ starcoder2-3b - GGUF
11
+ - Model creator: https://huggingface.co/bigcode/
12
+ - Original model: https://huggingface.co/bigcode/starcoder2-3b/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [starcoder2-3b.Q2_K.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q2_K.gguf) | Q2_K | 1.14GB |
18
+ | [starcoder2-3b.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ3_XS.gguf) | IQ3_XS | 1.22GB |
19
+ | [starcoder2-3b.IQ3_S.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ3_S.gguf) | IQ3_S | 1.28GB |
20
+ | [starcoder2-3b.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K_S.gguf) | Q3_K_S | 1.27GB |
21
+ | [starcoder2-3b.IQ3_M.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ3_M.gguf) | IQ3_M | 1.32GB |
22
+ | [starcoder2-3b.Q3_K.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K.gguf) | Q3_K | 1.46GB |
23
+ | [starcoder2-3b.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K_M.gguf) | Q3_K_M | 1.46GB |
24
+ | [starcoder2-3b.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K_L.gguf) | Q3_K_L | 1.62GB |
25
+ | [starcoder2-3b.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ4_XS.gguf) | IQ4_XS | 1.56GB |
26
+ | [starcoder2-3b.Q4_0.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_0.gguf) | Q4_0 | 1.63GB |
27
+ | [starcoder2-3b.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ4_NL.gguf) | IQ4_NL | 1.64GB |
28
+ | [starcoder2-3b.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_K_S.gguf) | Q4_K_S | 1.64GB |
29
+ | [starcoder2-3b.Q4_K.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_K.gguf) | Q4_K | 1.76GB |
30
+ | [starcoder2-3b.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_K_M.gguf) | Q4_K_M | 1.76GB |
31
+ | [starcoder2-3b.Q4_1.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_1.gguf) | Q4_1 | 1.8GB |
32
+ | [starcoder2-3b.Q5_0.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_0.gguf) | Q5_0 | 1.96GB |
33
+ | [starcoder2-3b.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_K_S.gguf) | Q5_K_S | 1.96GB |
34
+ | [starcoder2-3b.Q5_K.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_K.gguf) | Q5_K | 2.03GB |
35
+ | [starcoder2-3b.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_K_M.gguf) | Q5_K_M | 2.03GB |
36
+ | [starcoder2-3b.Q5_1.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_1.gguf) | Q5_1 | 2.13GB |
37
+ | [starcoder2-3b.Q6_K.gguf](https://huggingface.co/RichardErkhov/bigcode_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q6_K.gguf) | Q6_K | 2.32GB |
38
+
39
+
40
+
41
+
42
+ Original model description:
43
+ ---
44
+ pipeline_tag: text-generation
45
+ inference: true
46
+ widget:
47
+ - text: 'def print_hello_world():'
48
+ example_title: Hello world
49
+ group: Python
50
+ datasets:
51
+ - bigcode/the-stack-v2-train
52
+ license: bigcode-openrail-m
53
+ library_name: transformers
54
+ tags:
55
+ - code
56
+ model-index:
57
+ - name: starcoder2-3b
58
+ results:
59
+ - task:
60
+ type: text-generation
61
+ dataset:
62
+ name: CruxEval-I
63
+ type: cruxeval-i
64
+ metrics:
65
+ - type: pass@1
66
+ value: 32.7
67
+ - task:
68
+ type: text-generation
69
+ dataset:
70
+ name: DS-1000
71
+ type: ds-1000
72
+ metrics:
73
+ - type: pass@1
74
+ value: 25.0
75
+ - task:
76
+ type: text-generation
77
+ dataset:
78
+ name: GSM8K (PAL)
79
+ type: gsm8k-pal
80
+ metrics:
81
+ - type: accuracy
82
+ value: 27.7
83
+ - task:
84
+ type: text-generation
85
+ dataset:
86
+ name: HumanEval+
87
+ type: humanevalplus
88
+ metrics:
89
+ - type: pass@1
90
+ value: 27.4
91
+ - task:
92
+ type: text-generation
93
+ dataset:
94
+ name: HumanEval
95
+ type: humaneval
96
+ metrics:
97
+ - type: pass@1
98
+ value: 31.7
99
+ - task:
100
+ type: text-generation
101
+ dataset:
102
+ name: RepoBench-v1.1
103
+ type: repobench-v1.1
104
+ metrics:
105
+ - type: edit-smiliarity
106
+ value: 71.19
107
+ ---
108
+
109
+ # StarCoder2
110
+
111
+ <center>
112
+ <img src="https://huggingface.co/datasets/bigcode/admin_private/resolve/main/starcoder2_banner.png" alt="SC2" width="900" height="600">
113
+ </center>
114
+
115
+ ## Table of Contents
116
+
117
+ 1. [Model Summary](##model-summary)
118
+ 2. [Use](##use)
119
+ 3. [Limitations](##limitations)
120
+ 4. [Training](##training)
121
+ 5. [License](##license)
122
+ 6. [Citation](##citation)
123
+
124
+ ## Model Summary
125
+
126
+ StarCoder2-3B model is a 3B parameter model trained on 17 programming languages from [The Stack v2](https://huggingface.co/datasets/bigcode/the-stack-v2-train), with opt-out requests excluded. The model uses [Grouped Query Attention](https://arxiv.org/abs/2305.13245), [a context window of 16,384 tokens](https://arxiv.org/abs/2205.14135) with [a sliding window attention of 4,096 tokens](https://arxiv.org/abs/2004.05150v2), and was trained using the [Fill-in-the-Middle objective](https://arxiv.org/abs/2207.14255) on 3+ trillion tokens.
127
+
128
+ - **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)
129
+ - **Paper:** [Link](https://huggingface.co/papers/2402.19173)
130
+ - **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)
131
+ - **Languages:** 17 Programming languages
132
+
133
+ ## Use
134
+
135
+ ### Intended use
136
+
137
+ The model was trained on GitHub code as well as additional selected data sources such as Arxiv and Wikipedia. As such it is _not_ an instruction model and commands like "Write a function that computes the square root." do not work well.
138
+
139
+ ### Generation
140
+ Here are some examples to get started with the model. You can find a script for fine-tuning in StarCoder2's [GitHub repository](https://github.com/bigcode-project/starcoder2).
141
+
142
+ First, make sure to install `transformers` from source:
143
+ ```bash
144
+ pip install git+https://github.com/huggingface/transformers.git
145
+ ```
146
+
147
+ #### Running the model on CPU/GPU/multi GPU
148
+ * _Using full precision_
149
+ ```python
150
+ # pip install git+https://github.com/huggingface/transformers.git # TODO: merge PR to main
151
+ from transformers import AutoModelForCausalLM, AutoTokenizer
152
+
153
+ checkpoint = "bigcode/starcoder2-3b"
154
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
155
+
156
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
157
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
158
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
159
+
160
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
161
+ outputs = model.generate(inputs)
162
+ print(tokenizer.decode(outputs[0]))
163
+ ```
164
+ ```bash
165
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
166
+ Memory footprint: 12624.81 MB
167
+ ```
168
+ * _Using `torch.bfloat16`_
169
+ ```python
170
+ # pip install accelerate
171
+ import torch
172
+ from transformers import AutoTokenizer, AutoModelForCausalLM
173
+
174
+ checkpoint = "bigcode/starcoder2-3b"
175
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
176
+
177
+ # for fp16 use `torch_dtype=torch.float16` instead
178
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
179
+
180
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
181
+ outputs = model.generate(inputs)
182
+ print(tokenizer.decode(outputs[0]))
183
+ ```
184
+ ```bash
185
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
186
+ Memory footprint: 6312.41 MB
187
+ ```
188
+
189
+ #### Quantized Versions through `bitsandbytes`
190
+ * _Using 8-bit precision (int8)_
191
+
192
+ ```python
193
+ # pip install bitsandbytes accelerate
194
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
195
+
196
+ # to use 4bit use `load_in_4bit=True` instead
197
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
198
+
199
+ checkpoint = "bigcode/starcoder2-3b"
200
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
201
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
202
+
203
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
204
+ outputs = model.generate(inputs)
205
+ print(tokenizer.decode(outputs[0]))
206
+ ```
207
+ ```bash
208
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
209
+ # load_in_8bit
210
+ Memory footprint: 3434.07 MB
211
+ # load_in_4bit
212
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
213
+ Memory footprint: 1994.90 MB
214
+ ```
215
+ ### Attribution & Other Requirements
216
+
217
+ The pretraining dataset of the model was filtered for permissive licenses and code with no license only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. We provide a [search index](https://huggingface.co/spaces/bigcode/search-v2) that lets you search through the pretraining data to identify where the generated code came from, and apply the proper attribution to your code.
218
+
219
+ # Limitations
220
+
221
+ The model has been trained on source code from 600+ programming languages. The predominant language in source is English although other languages are also present. As such the model is capable to generate code snippets provided some context but the generated code is not guaranteed to work as intended. It can be inefficient, contain bugs or exploits. See [the paper](https://huggingface.co/papers/2402.19173) for an in-depth discussion of the model limitations.
222
+
223
+ # Training
224
+
225
+ ## Model
226
+
227
+ - **Architecture:** Transformer decoder with grouped-query and sliding window attention and Fill-in-the-Middle objective
228
+ - **Pretraining steps:** 1.2 million
229
+ - **Pretraining tokens:** 3+ trillion
230
+ - **Precision:** bfloat16
231
+
232
+ ## Hardware
233
+
234
+ - **GPUs:** 160 A100
235
+
236
+ ## Software
237
+
238
+ - **Framework:** TODO
239
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
240
+
241
+ # License
242
+
243
+ The model is licensed under the BigCode OpenRAIL-M v1 license agreement. You can find the full agreement [here](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement).
244
+
245
+ # Citation
246
+
247
+ ```bash
248
+ @misc{lozhkov2024starcoder,
249
+ title={StarCoder 2 and The Stack v2: The Next Generation},
250
+ author={Anton Lozhkov and Raymond Li and Loubna Ben Allal and Federico Cassano and Joel Lamy-Poirier and Nouamane Tazi and Ao Tang and Dmytro Pykhtar and Jiawei Liu and Yuxiang Wei and Tianyang Liu and Max Tian and Denis Kocetkov and Arthur Zucker and Younes Belkada and Zijian Wang and Qian Liu and Dmitry Abulkhanov and Indraneil Paul and Zhuang Li and Wen-Ding Li and Megan Risdal and Jia Li and Jian Zhu and Terry Yue Zhuo and Evgenii Zheltonozhskii and Nii Osae Osae Dade and Wenhao Yu and Lucas Krauß and Naman Jain and Yixuan Su and Xuanli He and Manan Dey and Edoardo Abati and Yekun Chai and Niklas Muennighoff and Xiangru Tang and Muhtasham Oblokulov and Christopher Akiki and Marc Marone and Chenghao Mou and Mayank Mishra and Alex Gu and Binyuan Hui and Tri Dao and Armel Zebaze and Olivier Dehaene and Nicolas Patry and Canwen Xu and Julian McAuley and Han Hu and Torsten Scholak and Sebastien Paquet and Jennifer Robinson and Carolyn Jane Anderson and Nicolas Chapados and Mostofa Patwary and Nima Tajbakhsh and Yacine Jernite and Carlos Muñoz Ferrandis and Lingming Zhang and Sean Hughes and Thomas Wolf and Arjun Guha and Leandro von Werra and Harm de Vries},
251
+ year={2024},
252
+ eprint={2402.19173},
253
+ archivePrefix={arXiv},
254
+ primaryClass={cs.SE}
255
+ }
256
+ ```
257
+