Text Generation
Transformers
code
gpt_bigcode
Eval Results
Inference Endpoints
text-generation-inference
prashrex commited on
Commit
398ca44
1 Parent(s): c004b65

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +303 -0
README.md ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigcode-openrail-m
3
+ datasets:
4
+ - bigcode/the-stack
5
+ language:
6
+ - code
7
+ programming_language:
8
+ - Java
9
+ - JavaScript
10
+ - Python
11
+ pipeline_tag: text-generation
12
+ inference: true
13
+ widget:
14
+ - text: 'def print_hello_world():'
15
+ example_title: Hello world
16
+ group: Python
17
+ model-index:
18
+ - name: SantaCoder
19
+ results:
20
+ - task:
21
+ type: text-generation
22
+ dataset:
23
+ type: nuprl/MultiPL-E
24
+ name: MultiPL HumanEval (Python)
25
+ metrics:
26
+ - name: pass@1
27
+ type: pass@1
28
+ value: 0.18
29
+ verified: false
30
+ - name: pass@10
31
+ type: pass@10
32
+ value: 0.29
33
+ verified: false
34
+ - name: pass@100
35
+ type: pass@100
36
+ value: 0.49
37
+ verified: false
38
+ - task:
39
+ type: text-generation
40
+ dataset:
41
+ type: nuprl/MultiPL-E
42
+ name: MultiPL MBPP (Python)
43
+ metrics:
44
+ - name: pass@1
45
+ type: pass@1
46
+ value: 0.35
47
+ verified: false
48
+ - name: pass@10
49
+ type: pass@10
50
+ value: 0.58
51
+ verified: false
52
+ - name: pass@100
53
+ type: pass@100
54
+ value: 0.77
55
+ verified: false
56
+ - task:
57
+ type: text-generation
58
+ dataset:
59
+ type: nuprl/MultiPL-E
60
+ name: MultiPL HumanEval (JavaScript)
61
+ metrics:
62
+ - name: pass@1
63
+ type: pass@1
64
+ value: 0.16
65
+ verified: false
66
+ - name: pass@10
67
+ type: pass@10
68
+ value: 0.27
69
+ verified: false
70
+ - name: pass@100
71
+ type: pass@100
72
+ value: 0.47
73
+ verified: false
74
+ - task:
75
+ type: text-generation
76
+ dataset:
77
+ type: nuprl/MultiPL-E
78
+ name: MultiPL MBPP (Javascript)
79
+ metrics:
80
+ - name: pass@1
81
+ type: pass@1
82
+ value: 0.28
83
+ verified: false
84
+ - name: pass@10
85
+ type: pass@10
86
+ value: 0.51
87
+ verified: false
88
+ - name: pass@100
89
+ type: pass@100
90
+ value: 0.7
91
+ verified: false
92
+ - task:
93
+ type: text-generation
94
+ dataset:
95
+ type: nuprl/MultiPL-E
96
+ name: MultiPL HumanEval (Java)
97
+ metrics:
98
+ - name: pass@1
99
+ type: pass@1
100
+ value: 0.15
101
+ verified: false
102
+ - name: pass@10
103
+ type: pass@10
104
+ value: 0.26
105
+ verified: false
106
+ - name: pass@100
107
+ type: pass@100
108
+ value: 0.41
109
+ verified: false
110
+ - task:
111
+ type: text-generation
112
+ dataset:
113
+ type: nuprl/MultiPL-E
114
+ name: MultiPL MBPP (Java)
115
+ metrics:
116
+ - name: pass@1
117
+ type: pass@1
118
+ value: 0.28
119
+ verified: false
120
+ - name: pass@10
121
+ type: pass@10
122
+ value: 0.44
123
+ verified: false
124
+ - name: pass@100
125
+ type: pass@100
126
+ value: 0.59
127
+ verified: false
128
+ - task:
129
+ type: text-generation
130
+ dataset:
131
+ type: loubnabnl/humaneval_infilling
132
+ name: HumanEval FIM (Python)
133
+ metrics:
134
+ - name: single_line
135
+ type: exact_match
136
+ value: 0.44
137
+ verified: false
138
+ - task:
139
+ type: text-generation
140
+ dataset:
141
+ type: nuprl/MultiPL-E
142
+ name: MultiPL HumanEval FIM (Java)
143
+ metrics:
144
+ - name: single_line
145
+ type: exact_match
146
+ value: 0.62
147
+ verified: false
148
+ - task:
149
+ type: text-generation
150
+ dataset:
151
+ type: nuprl/MultiPL-E
152
+ name: MultiPL HumanEval FIM (JavaScript)
153
+ metrics:
154
+ - name: single_line
155
+ type: exact_match
156
+ value: 0.6
157
+ verified: false
158
+ - task:
159
+ type: text-generation
160
+ dataset:
161
+ type: code_x_glue_ct_code_to_text
162
+ name: CodeXGLUE code-to-text (Python)
163
+ metrics:
164
+ - name: BLEU
165
+ type: bleu
166
+ value: 18.13
167
+ verified: false
168
+ ---
169
+
170
+ <h1 style="margin:20px;" align="center">This is a GGUF Version of SantaCoder</h1>
171
+ <h2 style="margin:20px;" align="center">Quantization Done by Prashant Vasudevan <a href="https://github.com/vprashrex">Github@vprashrex</a></h2>
172
+ <h2 style="margin:20px;" align="center">Quantization type Q4_K version</h2>
173
+
174
+ # SantaCoder
175
+
176
+ ![banner](https://huggingface.co/datasets/bigcode/admin/resolve/main/banner.png)
177
+
178
+ Play with the model on the [SantaCoder Space Demo](https://huggingface.co/spaces/bigcode/santacoder-demo).
179
+
180
+ # Table of Contents
181
+
182
+ 1. [Model Summary](#model-summary)
183
+ 2. [Use](#use)
184
+ 3. [Limitations](#limitations)
185
+ 4. [Training](#training)
186
+ 5. [License](#license)
187
+ 6. [Citation](#citation)
188
+
189
+ # Model Summary
190
+
191
+ The SantaCoder models are a series of 1.1B parameter models trained on the Python, Java, and JavaScript subset of [The Stack (v1.1)](https://huggingface.co/datasets/bigcode/the-stack) (which excluded opt-out requests).
192
+ The main model uses [Multi Query Attention](https://arxiv.org/abs/1911.02150), a context window of 2048 tokens, and was trained using near-deduplication and comment-to-code ratio as filtering criteria and using the [Fill-in-the-Middle objective](https://arxiv.org/abs/2207.14255).
193
+ In addition there are several models that were trained on datasets with different filter parameters and with architecture and objective variations.
194
+
195
+ - **Repository:** [bigcode/Megatron-LM](https://github.com/bigcode-project/Megatron-LM)
196
+ - **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)
197
+ - **Paper:** [🎅SantaCoder: Don't reach for the stars!🌟](https://arxiv.org/abs/2301.03988)
198
+ - **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)
199
+ - **Languages:** Python, Java, and JavaScript
200
+
201
+ |Model|Architecture|Objective|Filtering|
202
+ |:-|:-|:-|:-|
203
+ |`mha`|MHA|AR + FIM| Base |
204
+ |`no-fim`| MQA | AR| Base |
205
+ |`fim`| MQA | AR + FIM | Base |
206
+ |`stars`| MQA | AR + FIM | GitHub stars |
207
+ |`fertility`| MQA | AR + FIM | Tokenizer fertility |
208
+ |`comments`| MQA | AR + FIM | Comment-to-code ratio |
209
+ |`dedup-alt`| MQA | AR + FIM | Stronger near-deduplication |
210
+ |`final`| MQA | AR + FIM | Stronger near-deduplication and comment-to-code ratio |
211
+
212
+ The `final` model is the best performing model and was trained twice as long (236B tokens) as the others. This checkpoint is the default model and available on the `main` branch. All other checkpoints are on separate branches with according names.
213
+
214
+ # Use
215
+
216
+ ## Intended use
217
+
218
+ The model was trained on GitHub code. As such it is _not_ an instruction model and commands like "Write a function that computes the square root." do not work well.
219
+ You should phrase commands like they occur in source code such as comments (e.g. `# the following function computes the sqrt`) or write a function signature and docstring and let the model complete the function body.
220
+
221
+ **Feel free to share your generations in the Community tab!**
222
+
223
+ ## How to use
224
+
225
+ ### Generation
226
+ ```python
227
+ # pip install -q transformers
228
+ from transformers import AutoModelForCausalLM, AutoTokenizer
229
+
230
+ checkpoint = "bigcode/santacoder"
231
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
232
+
233
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
234
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to(device)
235
+
236
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
237
+ outputs = model.generate(inputs)
238
+ print(tokenizer.decode(outputs[0]))
239
+ ```
240
+
241
+ ### Fill-in-the-middle
242
+ Fill-in-the-middle uses special tokens to identify the prefix/middle/suffix part of the input and output:
243
+
244
+ ```python
245
+ input_text = "<fim-prefix>def print_hello_world():\n <fim-suffix>\n print('Hello world!')<fim-middle>"
246
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
247
+ outputs = model.generate(inputs)
248
+ print(tokenizer.decode(outputs[0]))
249
+ ```
250
+ Make sure to use `<fim-prefix>, <fim-suffix>, <fim-middle>` and not `<fim_prefix>, <fim_suffix>, <fim_middle>` as in StarCoder models.
251
+
252
+ ### Load other checkpoints
253
+ We upload the checkpoint of each experiment to a separate branch as well as the intermediate checkpoints as commits on the branches. You can load them with the `revision` flag:
254
+
255
+ ```python
256
+ model = AutoModelForCausalLM.from_pretrained(
257
+ "bigcode/santacoder",
258
+ revision="no-fim", # name of branch or commit hash
259
+ trust_remote_code=True
260
+ )
261
+ ```
262
+
263
+ ### Attribution & Other Requirements
264
+
265
+ The pretraining dataset of the model was filtered for permissive licenses 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/santacoder-search) that let's you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.
266
+
267
+ # Limitations
268
+
269
+ The model has been trained on source code in Python, Java, and JavaScript. 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.
270
+
271
+ # Training
272
+
273
+ ## Model
274
+
275
+ - **Architecture:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective
276
+ - **Pretraining steps:** 600K
277
+ - **Pretraining tokens:** 236 billion
278
+ - **Precision:** float16
279
+
280
+ ## Hardware
281
+
282
+ - **GPUs:** 96 Tesla V100
283
+ - **Training time:** 6.2 days
284
+ - **Total FLOPS:** 2.1 x 10e21
285
+
286
+ ## Software
287
+
288
+ - **Orchestration:** [Megatron-LM](https://github.com/bigcode-project/Megatron-LM)
289
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
290
+ - **FP16 if applicable:** [apex](https://github.com/NVIDIA/apex)
291
+
292
+ # License
293
+ 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).
294
+
295
+ # Citation
296
+ ```
297
+ @article{allal2023santacoder,
298
+ title={SantaCoder: don't reach for the stars!},
299
+ author={Allal, Loubna Ben and Li, Raymond and Kocetkov, Denis and Mou, Chenghao and Akiki, Christopher and Ferrandis, Carlos Munoz and Muennighoff, Niklas and Mishra, Mayank and Gu, Alex and Dey, Manan and others},
300
+ journal={arXiv preprint arXiv:2301.03988},
301
+ year={2023}
302
+ }
303
+ ```