RichardErkhov commited on
Commit
20a0ff7
·
verified ·
1 Parent(s): 458b1de

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +255 -0
README.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/milandean/
12
+ - Original model: https://huggingface.co/milandean/starcoder2-3b/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [starcoder2-3b.Q2_K.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q2_K.gguf) | Q2_K | 1.14GB |
18
+ | [starcoder2-3b.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K_S.gguf) | Q3_K_S | 1.27GB |
19
+ | [starcoder2-3b.Q3_K.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K.gguf) | Q3_K | 1.46GB |
20
+ | [starcoder2-3b.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K_M.gguf) | Q3_K_M | 1.46GB |
21
+ | [starcoder2-3b.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q3_K_L.gguf) | Q3_K_L | 1.62GB |
22
+ | [starcoder2-3b.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ4_XS.gguf) | IQ4_XS | 1.56GB |
23
+ | [starcoder2-3b.Q4_0.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_0.gguf) | Q4_0 | 1.63GB |
24
+ | [starcoder2-3b.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.IQ4_NL.gguf) | IQ4_NL | 1.64GB |
25
+ | [starcoder2-3b.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_K_S.gguf) | Q4_K_S | 1.64GB |
26
+ | [starcoder2-3b.Q4_K.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_K.gguf) | Q4_K | 1.76GB |
27
+ | [starcoder2-3b.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_K_M.gguf) | Q4_K_M | 1.76GB |
28
+ | [starcoder2-3b.Q4_1.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q4_1.gguf) | Q4_1 | 1.8GB |
29
+ | [starcoder2-3b.Q5_0.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_0.gguf) | Q5_0 | 1.96GB |
30
+ | [starcoder2-3b.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_K_S.gguf) | Q5_K_S | 1.96GB |
31
+ | [starcoder2-3b.Q5_K.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_K.gguf) | Q5_K | 2.03GB |
32
+ | [starcoder2-3b.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_K_M.gguf) | Q5_K_M | 2.03GB |
33
+ | [starcoder2-3b.Q5_1.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q5_1.gguf) | Q5_1 | 2.13GB |
34
+ | [starcoder2-3b.Q6_K.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q6_K.gguf) | Q6_K | 2.32GB |
35
+ | [starcoder2-3b.Q8_0.gguf](https://huggingface.co/RichardErkhov/milandean_-_starcoder2-3b-gguf/blob/main/starcoder2-3b.Q8_0.gguf) | Q8_0 | 3.0GB |
36
+
37
+
38
+
39
+
40
+ Original model description:
41
+ ---
42
+ pipeline_tag: text-generation
43
+ inference: true
44
+ widget:
45
+ - text: 'def print_hello_world():'
46
+ example_title: Hello world
47
+ group: Python
48
+ datasets:
49
+ - bigcode/the-stack-v2-train
50
+ license: bigcode-openrail-m
51
+ library_name: transformers
52
+ tags:
53
+ - code
54
+ model-index:
55
+ - name: starcoder2-3b
56
+ results:
57
+ - task:
58
+ type: text-generation
59
+ dataset:
60
+ name: CruxEval-I
61
+ type: cruxeval-i
62
+ metrics:
63
+ - type: pass@1
64
+ value: 32.7
65
+ - task:
66
+ type: text-generation
67
+ dataset:
68
+ name: DS-1000
69
+ type: ds-1000
70
+ metrics:
71
+ - type: pass@1
72
+ value: 25.0
73
+ - task:
74
+ type: text-generation
75
+ dataset:
76
+ name: GSM8K (PAL)
77
+ type: gsm8k-pal
78
+ metrics:
79
+ - type: accuracy
80
+ value: 27.7
81
+ - task:
82
+ type: text-generation
83
+ dataset:
84
+ name: HumanEval+
85
+ type: humanevalplus
86
+ metrics:
87
+ - type: pass@1
88
+ value: 27.4
89
+ - task:
90
+ type: text-generation
91
+ dataset:
92
+ name: HumanEval
93
+ type: humaneval
94
+ metrics:
95
+ - type: pass@1
96
+ value: 31.7
97
+ - task:
98
+ type: text-generation
99
+ dataset:
100
+ name: RepoBench-v1.1
101
+ type: repobench-v1.1
102
+ metrics:
103
+ - type: edit-smiliarity
104
+ value: 71.19
105
+ ---
106
+
107
+ # StarCoder2
108
+
109
+ <center>
110
+ <img src="https://huggingface.co/datasets/bigcode/admin_private/resolve/main/starcoder2_banner.png" alt="SC2" width="900" height="600">
111
+ </center>
112
+
113
+ ## Table of Contents
114
+
115
+ 1. [Model Summary](##model-summary)
116
+ 2. [Use](##use)
117
+ 3. [Limitations](##limitations)
118
+ 4. [Training](##training)
119
+ 5. [License](##license)
120
+ 6. [Citation](##citation)
121
+
122
+ ## Model Summary
123
+
124
+ 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.
125
+
126
+ - **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)
127
+ - **Paper:** [Link](https://huggingface.co/papers/2402.19173)
128
+ - **Point of Contact:** [[email protected]](mailto:[email protected])
129
+ - **Languages:** 17 Programming languages
130
+
131
+ ## Use
132
+
133
+ ### Intended use
134
+
135
+ 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.
136
+
137
+ ### Generation
138
+ 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).
139
+
140
+ First, make sure to install `transformers` from source:
141
+ ```bash
142
+ pip install git+https://github.com/huggingface/transformers.git
143
+ ```
144
+
145
+ #### Running the model on CPU/GPU/multi GPU
146
+ * _Using full precision_
147
+ ```python
148
+ # pip install git+https://github.com/huggingface/transformers.git # TODO: merge PR to main
149
+ from transformers import AutoModelForCausalLM, AutoTokenizer
150
+
151
+ checkpoint = "bigcode/starcoder2-3b"
152
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
153
+
154
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
155
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
156
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
157
+
158
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
159
+ outputs = model.generate(inputs)
160
+ print(tokenizer.decode(outputs[0]))
161
+ ```
162
+ ```bash
163
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
164
+ Memory footprint: 12624.81 MB
165
+ ```
166
+ * _Using `torch.bfloat16`_
167
+ ```python
168
+ # pip install accelerate
169
+ import torch
170
+ from transformers import AutoTokenizer, AutoModelForCausalLM
171
+
172
+ checkpoint = "bigcode/starcoder2-3b"
173
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
174
+
175
+ # for fp16 use `torch_dtype=torch.float16` instead
176
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
177
+
178
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
179
+ outputs = model.generate(inputs)
180
+ print(tokenizer.decode(outputs[0]))
181
+ ```
182
+ ```bash
183
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
184
+ Memory footprint: 6312.41 MB
185
+ ```
186
+
187
+ #### Quantized Versions through `bitsandbytes`
188
+ * _Using 8-bit precision (int8)_
189
+
190
+ ```python
191
+ # pip install bitsandbytes accelerate
192
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
193
+
194
+ # to use 4bit use `load_in_4bit=True` instead
195
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
196
+
197
+ checkpoint = "bigcode/starcoder2-3b"
198
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
199
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
200
+
201
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
202
+ outputs = model.generate(inputs)
203
+ print(tokenizer.decode(outputs[0]))
204
+ ```
205
+ ```bash
206
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
207
+ # load_in_8bit
208
+ Memory footprint: 3434.07 MB
209
+ # load_in_4bit
210
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
211
+ Memory footprint: 1994.90 MB
212
+ ```
213
+ ### Attribution & Other Requirements
214
+
215
+ 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.
216
+
217
+ # Limitations
218
+
219
+ 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.
220
+
221
+ # Training
222
+
223
+ ## Model
224
+
225
+ - **Architecture:** Transformer decoder with grouped-query and sliding window attention and Fill-in-the-Middle objective
226
+ - **Pretraining steps:** 1.2 million
227
+ - **Pretraining tokens:** 3+ trillion
228
+ - **Precision:** bfloat16
229
+
230
+ ## Hardware
231
+
232
+ - **GPUs:** 160 A100
233
+
234
+ ## Software
235
+
236
+ - **Framework:** TODO
237
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
238
+
239
+ # License
240
+
241
+ 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).
242
+
243
+ # Citation
244
+
245
+ ```bash
246
+ @misc{lozhkov2024starcoder,
247
+ title={StarCoder 2 and The Stack v2: The Next Generation},
248
+ 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},
249
+ year={2024},
250
+ eprint={2402.19173},
251
+ archivePrefix={arXiv},
252
+ primaryClass={cs.SE}
253
+ }
254
+ ```
255
+