michaelfeil commited on
Commit
56461e7
1 Parent(s): f40291f

Upload bigcode/starcoderbase-3b ctranslate2 weights

Browse files
README.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: text-generation
3
+ inference: true
4
+ widget:
5
+ - text: 'def print_hello_world():'
6
+ example_title: Hello world
7
+ group: Python
8
+ license: bigcode-openrail-m
9
+ datasets:
10
+ - bigcode/the-stack-dedup
11
+ metrics:
12
+ - code_eval
13
+ library_name: transformers
14
+ tags:
15
+ - ctranslate2
16
+ - int8
17
+ - float16
18
+ - code
19
+ model-index:
20
+ - name: StarCoderBase-3B
21
+ results:
22
+ - task:
23
+ type: text-generation
24
+ dataset:
25
+ type: openai_humaneval
26
+ name: HumanEval
27
+ metrics:
28
+ - name: pass@1
29
+ type: pass@1
30
+ value: 21.46
31
+ verified: false
32
+ - task:
33
+ type: text-generation
34
+ dataset:
35
+ type: nuprl/MultiPL-E
36
+ name: MultiPL-HumanEval (C++)
37
+ metrics:
38
+ - name: pass@1
39
+ type: pass@1
40
+ value: 19.43
41
+ verified: false
42
+ - task:
43
+ type: text-generation
44
+ dataset:
45
+ type: nuprl/MultiPL-E
46
+ name: MultiPL-HumanEval (Java)
47
+ metrics:
48
+ - name: pass@1
49
+ type: pass@1
50
+ value: 19.25
51
+ verified: false
52
+ - task:
53
+ type: text-generation
54
+ dataset:
55
+ type: nuprl/MultiPL-E
56
+ name: MultiPL-HumanEval (JavaScript)
57
+ metrics:
58
+ - name: pass@1
59
+ type: pass@1
60
+ value: 21.32
61
+ verified: false
62
+ - task:
63
+ type: text-generation
64
+ dataset:
65
+ type: nuprl/MultiPL-E
66
+ name: MultiPL-HumanEval (PHP)
67
+ metrics:
68
+ - name: pass@1
69
+ type: pass@1
70
+ value: 18.55
71
+ verified: false
72
+ - task:
73
+ type: text-generation
74
+ dataset:
75
+ type: nuprl/MultiPL-E
76
+ name: MultiPL-HumanEval (Lua)
77
+ metrics:
78
+ - name: pass@1
79
+ type: pass@1
80
+ value: 18.04
81
+ verified: false
82
+ - task:
83
+ type: text-generation
84
+ dataset:
85
+ type: nuprl/MultiPL-E
86
+ name: MultiPL-HumanEval (Rust)
87
+ metrics:
88
+ - name: pass@1
89
+ type: pass@1
90
+ value: 16.32
91
+ verified: false
92
+ - task:
93
+ type: text-generation
94
+ dataset:
95
+ type: nuprl/MultiPL-E
96
+ name: MultiPL-HumanEval (Swift)
97
+ metrics:
98
+ - name: pass@1
99
+ type: pass@1
100
+ value: 9.98
101
+ verified: false
102
+ - task:
103
+ type: text-generation
104
+ dataset:
105
+ type: nuprl/MultiPL-E
106
+ name: MultiPL-HumanEval (Julia)
107
+ metrics:
108
+ - name: pass@1
109
+ type: pass@1
110
+ value: 16.10
111
+ verified: false
112
+ - task:
113
+ type: text-generation
114
+ dataset:
115
+ type: nuprl/MultiPL-E
116
+ name: MultiPL-HumanEval (R)
117
+ metrics:
118
+ - name: pass@1
119
+ type: pass@1
120
+ value: 10.10
121
+ verified: false
122
+ extra_gated_prompt: >-
123
+ ## Model License Agreement
124
+
125
+ Please read the BigCode [OpenRAIL-M
126
+ license](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement)
127
+ agreement before accepting it.
128
+
129
+ extra_gated_fields:
130
+ I accept the above license agreement, and will use the Model complying with the set of use restrictions and sharing requirements: checkbox
131
+ ---
132
+ # # Fast-Inference with Ctranslate2
133
+ Speedup inference while reducing memory by 2x-4x using int8 inference in C++ on CPU or GPU.
134
+
135
+ quantized version of [bigcode/starcoderbase-3b](https://huggingface.co/bigcode/starcoderbase-3b)
136
+ ```bash
137
+ pip install hf-hub-ctranslate2>=2.12.0 ctranslate2>=3.17.1
138
+ ```
139
+
140
+ ```python
141
+ # from transformers import AutoTokenizer
142
+ model_name = "michaelfeil/ct2fast-starcoderbase-3b"
143
+
144
+
145
+ from hf_hub_ctranslate2 import GeneratorCT2fromHfHub
146
+ model = GeneratorCT2fromHfHub(
147
+ # load in int8 on CUDA
148
+ model_name_or_path=model_name,
149
+ device="cuda",
150
+ compute_type="int8_float16",
151
+ # tokenizer=AutoTokenizer.from_pretrained("{ORG}/{NAME}")
152
+ )
153
+ outputs = model.generate(
154
+ text=["def fibonnaci(", "User: How are you doing? Bot:"],
155
+ max_length=64,
156
+ include_prompt_in_result=False
157
+ )
158
+ print(outputs)
159
+ ```
160
+
161
+ Checkpoint compatible to [ctranslate2>=3.17.1](https://github.com/OpenNMT/CTranslate2)
162
+ and [hf-hub-ctranslate2>=2.12.0](https://github.com/michaelfeil/hf-hub-ctranslate2)
163
+ - `compute_type=int8_float16` for `device="cuda"`
164
+ - `compute_type=int8` for `device="cpu"`
165
+
166
+ Converted on 2023-07-28 using
167
+ ```
168
+ LLama-2 -> removed <pad> token.
169
+ ```
170
+
171
+ # Licence and other remarks:
172
+ This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
173
+
174
+ # Original description
175
+
176
+
177
+
178
+ # StarCoder-3B
179
+
180
+ 3B version of [StarCoderBase](https://huggingface.co/bigcode/starcoderbase).
181
+
182
+ ## Table of Contents
183
+
184
+ 1. [Model Summary](##model-summary)
185
+ 2. [Use](##use)
186
+ 3. [Limitations](##limitations)
187
+ 4. [Training](##training)
188
+ 5. [License](##license)
189
+ 6. [Citation](##citation)
190
+
191
+ ## Model Summary
192
+
193
+ StarCoder-3B is a 3B parameter model trained on 80+ programming languages from [The Stack (v1.2)](https://huggingface.co/datasets/bigcode/the-stack), with opt-out requests excluded. The model uses [Multi Query Attention](https://arxiv.org/abs/1911.02150), [a context window of 8192 tokens](https://arxiv.org/abs/2205.14135), and was trained using the [Fill-in-the-Middle objective](https://arxiv.org/abs/2207.14255) on 1 trillion tokens.
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:** [💫StarCoder: May the source be with you!](https://arxiv.org/abs/2305.06161)
198
+ - **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)
199
+ - **Languages:** 80+ Programming languages
200
+
201
+
202
+ ## Use
203
+
204
+ ### Intended use
205
+
206
+ 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. However, by using the [Tech Assistant prompt](https://huggingface.co/datasets/bigcode/ta-prompt) you can turn it into a capable technical assistant.
207
+
208
+ **Feel free to share your generations in the Community tab!**
209
+
210
+ ### Generation
211
+ ```python
212
+ # pip install -q transformers
213
+ from transformers import AutoModelForCausalLM, AutoTokenizer
214
+
215
+ checkpoint = "bigcode/starcoderbase-3b"
216
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
217
+
218
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
219
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
220
+
221
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
222
+ outputs = model.generate(inputs)
223
+ print(tokenizer.decode(outputs[0]))
224
+ ```
225
+
226
+ ### Fill-in-the-middle
227
+ Fill-in-the-middle uses special tokens to identify the prefix/middle/suffix part of the input and output:
228
+
229
+ ```python
230
+ input_text = "<fim_prefix>def print_hello_world():\n <fim_suffix>\n print('Hello world!')<fim_middle>"
231
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
232
+ outputs = model.generate(inputs)
233
+ print(tokenizer.decode(outputs[0]))
234
+ ```
235
+
236
+ ### Attribution & Other Requirements
237
+
238
+ 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/starcoder-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.
239
+
240
+ # Limitations
241
+
242
+ The model has been trained on source code from 80+ programming languages. The predominant natural language in source code 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, contain bugs or exploits. See [the paper](https://drive.google.com/file/d/1cN-b9GnWtHzQRoE7M7gAEyivY0kl4BYs/view) for an in-depth discussion of the model limitations.
243
+
244
+ # Training
245
+
246
+ ## Model
247
+
248
+ - **Architecture:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective
249
+ - **Pretraining steps:** 500k
250
+ - **Pretraining tokens:** 1 trillion
251
+ - **Precision:** bfloat16
252
+
253
+ ## Hardware
254
+
255
+ - **GPUs:** 256 Tesla A100
256
+ - **Training time:** 12 days
257
+
258
+ ## Software
259
+
260
+ - **Orchestration:** [Megatron-LM](https://github.com/bigcode-project/Megatron-LM)
261
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
262
+ - **BP16 if applicable:** [apex](https://github.com/NVIDIA/apex)
263
+
264
+ # License
265
+ 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).
266
+ # Citation
267
+ ```
268
+ @article{li2023starcoder,
269
+ title={StarCoder: may the source be with you!},
270
+ author={Raymond Li and Loubna Ben Allal and Yangtian Zi and Niklas Muennighoff and Denis Kocetkov and Chenghao Mou and Marc Marone and Christopher Akiki and Jia Li and Jenny Chim and Qian Liu and Evgenii Zheltonozhskii and Terry Yue Zhuo and Thomas Wang and Olivier Dehaene and Mishig Davaadorj and Joel Lamy-Poirier and João Monteiro and Oleh Shliazhko and Nicolas Gontier and Nicholas Meade and Armel Zebaze and Ming-Ho Yee and Logesh Kumar Umapathi and Jian Zhu and Benjamin Lipkin and Muhtasham Oblokulov and Zhiruo Wang and Rudra Murthy and Jason Stillerman and Siva Sankalp Patel and Dmitry Abulkhanov and Marco Zocca and Manan Dey and Zhihan Zhang and Nour Fahmy and Urvashi Bhattacharyya and Wenhao Yu and Swayam Singh and Sasha Luccioni and Paulo Villegas and Maxim Kunakov and Fedor Zhdanov and Manuel Romero and Tony Lee and Nadav Timor and Jennifer Ding and Claire Schlesinger and Hailey Schoelkopf and Jan Ebert and Tri Dao and Mayank Mishra and Alex Gu and Jennifer Robinson and Carolyn Jane Anderson and Brendan Dolan-Gavitt and Danish Contractor and Siva Reddy and Daniel Fried and Dzmitry Bahdanau and Yacine Jernite and Carlos Muñoz Ferrandis and Sean Hughes and Thomas Wolf and Arjun Guha and Leandro von Werra and Harm de Vries},
271
+ year={2023},
272
+ eprint={2305.06161},
273
+ archivePrefix={arXiv},
274
+ primaryClass={cs.CL}
275
+ }
276
+ ```
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/fsx/bigcode/experiments/pretraining/conversions/starcoder-3b",
3
+ "activation_function": "gelu_pytorch_tanh",
4
+ "architectures": [
5
+ "GPTBigCodeForCausalLM"
6
+ ],
7
+ "attention_softmax_in_fp32": true,
8
+ "multi_query": true,
9
+ "attn_pdrop": 0.1,
10
+ "bos_token_id": 0,
11
+ "embd_pdrop": 0.1,
12
+ "eos_token_id": 0,
13
+ "inference_runner": 0,
14
+ "initializer_range": 0.02,
15
+ "layer_norm_epsilon": null,
16
+ "max_batch_size": null,
17
+ "max_sequence_length": null,
18
+ "model_type": "gpt_bigcode",
19
+ "n_embd": 2816,
20
+ "n_head": 22,
21
+ "n_inner": 11264,
22
+ "n_layer": 36,
23
+ "n_positions": 8192,
24
+ "pad_key_length": true,
25
+ "pre_allocate_kv_cache": false,
26
+ "resid_pdrop": 0.1,
27
+ "scale_attention_softmax_in_fp32": true,
28
+ "scale_attn_weights": true,
29
+ "summary_activation": null,
30
+ "summary_first_dropout": 0.1,
31
+ "summary_proj_to_labels": true,
32
+ "summary_type": "cls_index",
33
+ "summary_use_proj": true,
34
+ "torch_dtype": "float32",
35
+ "transformers_version": "4.28.1",
36
+ "use_cache": true,
37
+ "validate_runner_input": true,
38
+ "vocab_size": 49152,
39
+ "bos_token": "<|endoftext|>",
40
+ "eos_token": "<|endoftext|>",
41
+ "unk_token": "<|endoftext|>"
42
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "transformers_version": "4.30.2"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6cf02f374068af78f5c6d98493a789aabca8b9eb3963ebf2d42d684e93512f7
3
+ size 3070616863
special_tokens_map.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|endoftext|>",
4
+ "<fim_prefix>",
5
+ "<fim_middle>",
6
+ "<fim_suffix>",
7
+ "<fim_pad>",
8
+ "<filename>",
9
+ "<gh_stars>",
10
+ "<issue_start>",
11
+ "<issue_comment>",
12
+ "<issue_closed>",
13
+ "<jupyter_start>",
14
+ "<jupyter_text>",
15
+ "<jupyter_code>",
16
+ "<jupyter_output>",
17
+ "<empty_output>",
18
+ "<commit_before>",
19
+ "<commit_msg>",
20
+ "<commit_after>",
21
+ "<reponame>"
22
+ ],
23
+ "bos_token": "<|endoftext|>",
24
+ "eos_token": "<|endoftext|>",
25
+ "unk_token": "<|endoftext|>"
26
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "additional_special_tokens": [
4
+ "<|endoftext|>",
5
+ "<fim_prefix>",
6
+ "<fim_middle>",
7
+ "<fim_suffix>",
8
+ "<fim_pad>",
9
+ "<filename>",
10
+ "<gh_stars>",
11
+ "<issue_start>",
12
+ "<issue_comment>",
13
+ "<issue_closed>",
14
+ "<jupyter_start>",
15
+ "<jupyter_text>",
16
+ "<jupyter_code>",
17
+ "<jupyter_output>",
18
+ "<empty_output>",
19
+ "<commit_before>",
20
+ "<commit_msg>",
21
+ "<commit_after>",
22
+ "<reponame>"
23
+ ],
24
+ "bos_token": "<|endoftext|>",
25
+ "eos_token": "<|endoftext|>",
26
+ "model_max_length": 1000000000000000019884624838656,
27
+ "tokenizer_class": "GPT2Tokenizer",
28
+ "unk_token": "<|endoftext|>",
29
+ "vocab_size": 49152
30
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
vocabulary.json ADDED
The diff for this file is too large to render. See raw diff
 
vocabulary.txt ADDED
The diff for this file is too large to render. See raw diff