Text Generation
Transformers
GGUF
code
Eval Results
Inference Endpoints
aashish1904 commited on
Commit
5db4d0f
1 Parent(s): 02c5c85

Upload README.md with huggingface_hub

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