RichardErkhov commited on
Commit
a5a0d65
·
verified ·
1 Parent(s): 8fc1ebf

uploaded readme

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