lainlives commited on
Commit
3ee2d2c
·
verified ·
1 Parent(s): 4f0fffe

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +235 -0
  2. config.json +49 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +54 -0
README.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - bigcode/starcoder2-15b
4
+ pipeline_tag: text-generation
5
+ inference:
6
+ parameters:
7
+ temperature: 0.2
8
+ top_p: 0.95
9
+ widget:
10
+ - text: 'def print_hello_world():'
11
+ example_title: Hello world
12
+ group: Python
13
+ datasets:
14
+ - bigcode/the-stack-v2-train
15
+ license: bigcode-openrail-m
16
+ library_name: transformers
17
+ tags:
18
+ - bnb-my-repo
19
+ - code
20
+ model-index:
21
+ - name: starcoder2-15b
22
+ results:
23
+ - task:
24
+ type: text-generation
25
+ dataset:
26
+ name: CruxEval-I
27
+ type: cruxeval-i
28
+ metrics:
29
+ - type: pass@1
30
+ value: 48.1
31
+ - task:
32
+ type: text-generation
33
+ dataset:
34
+ name: DS-1000
35
+ type: ds-1000
36
+ metrics:
37
+ - type: pass@1
38
+ value: 33.8
39
+ - task:
40
+ type: text-generation
41
+ dataset:
42
+ name: GSM8K (PAL)
43
+ type: gsm8k-pal
44
+ metrics:
45
+ - type: accuracy
46
+ value: 65.1
47
+ - task:
48
+ type: text-generation
49
+ dataset:
50
+ name: HumanEval+
51
+ type: humanevalplus
52
+ metrics:
53
+ - type: pass@1
54
+ value: 37.8
55
+ - task:
56
+ type: text-generation
57
+ dataset:
58
+ name: HumanEval
59
+ type: humaneval
60
+ metrics:
61
+ - type: pass@1
62
+ value: 46.3
63
+ - task:
64
+ type: text-generation
65
+ dataset:
66
+ name: RepoBench-v1.1
67
+ type: repobench-v1.1
68
+ metrics:
69
+ - type: edit-smiliarity
70
+ value: 74.08
71
+ ---
72
+ # bigcode/starcoder2-15b (Quantized)
73
+
74
+ ## Description
75
+ This model is a quantized version of the original model [`bigcode/starcoder2-15b`](https://huggingface.co/bigcode/starcoder2-15b).
76
+
77
+ ## Quantization Details
78
+ - **Quantization Type**: int4
79
+ - **bnb_4bit_quant_type**: nf4
80
+ - **bnb_4bit_use_double_quant**: True
81
+ - **bnb_4bit_compute_dtype**: bfloat16
82
+ - **bnb_4bit_quant_storage**: uint8
83
+
84
+
85
+
86
+ # 📄 Original Model Information
87
+
88
+
89
+
90
+ # StarCoder2
91
+
92
+ <center>
93
+ <img src="https://huggingface.co/datasets/bigcode/admin_private/resolve/main/starcoder2_banner.png" alt="SC2" width="900" height="600">
94
+ </center>
95
+
96
+ ## Table of Contents
97
+
98
+ 1. [Model Summary](#model-summary)
99
+ 2. [Use](#use)
100
+ 3. [Limitations](#limitations)
101
+ 4. [Training](#training)
102
+ 5. [License](#license)
103
+ 6. [Citation](#citation)
104
+
105
+ ## Model Summary
106
+
107
+ StarCoder2-15B model is a 15B parameter model trained on 600+ 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 4+ trillion tokens.
108
+ The model was trained with [NVIDIA NeMo™ Framework](https://www.nvidia.com/en-us/ai-data-science/generative-ai/nemo-framework/) using the [NVIDIA Eos Supercomputer](https://blogs.nvidia.com/blog/eos/) built with [NVIDIA DGX H100](https://www.nvidia.com/en-us/data-center/dgx-h100/) systems.
109
+
110
+ - **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)
111
+ - **Paper:** [Link](https://huggingface.co/papers/2402.19173)
112
+ - **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)
113
+ - **Languages:** 600+ Programming languages
114
+
115
+ ## Use
116
+
117
+ ### Intended use
118
+
119
+ 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.
120
+
121
+ ### Generation
122
+ 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).
123
+
124
+ First, make sure to install `transformers` from source:
125
+ ```bash
126
+ pip install git+https://github.com/huggingface/transformers.git
127
+ ```
128
+
129
+ #### Running the model on CPU/GPU/multi GPU
130
+ * _Using full precision_
131
+ ```python
132
+ # pip install git+https://github.com/huggingface/transformers.git # TODO: merge PR to main
133
+ from transformers import AutoModelForCausalLM, AutoTokenizer
134
+
135
+ checkpoint = "bigcode/starcoder2-15b"
136
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
137
+
138
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
139
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
140
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
141
+
142
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
143
+ outputs = model.generate(inputs)
144
+ print(tokenizer.decode(outputs[0]))
145
+ ```
146
+
147
+ * _Using `torch.bfloat16`_
148
+ ```python
149
+ # pip install accelerate
150
+ import torch
151
+ from transformers import AutoTokenizer, AutoModelForCausalLM
152
+
153
+ checkpoint = "bigcode/starcoder2-15b"
154
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
155
+
156
+ # for fp16 use `torch_dtype=torch.float16` instead
157
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
158
+
159
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
160
+ outputs = model.generate(inputs)
161
+ print(tokenizer.decode(outputs[0]))
162
+ ```
163
+ ```bash
164
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
165
+ Memory footprint: 32251.33 MB
166
+ ```
167
+
168
+ #### Quantized Versions through `bitsandbytes`
169
+ * _Using 8-bit precision (int8)_
170
+
171
+ ```python
172
+ # pip install bitsandbytes accelerate
173
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
174
+
175
+ # to use 4bit use `load_in_4bit=True` instead
176
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
177
+
178
+ checkpoint = "bigcode/starcoder2-15b"
179
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
180
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
181
+
182
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
183
+ outputs = model.generate(inputs)
184
+ print(tokenizer.decode(outputs[0]))
185
+ ```
186
+ ```bash
187
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
188
+ # load_in_8bit
189
+ Memory footprint: 16900.18 MB
190
+ # load_in_4bit
191
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
192
+ Memory footprint: 9224.60 MB
193
+ ```
194
+ ### Attribution & Other Requirements
195
+
196
+ 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 let's you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.
197
+
198
+ # Limitations
199
+
200
+ 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.
201
+
202
+ # Training
203
+
204
+ ## Model
205
+
206
+ - **Architecture:** Transformer decoder with grouped-query and sliding window attention and Fill-in-the-Middle objective
207
+ - **Pretraining steps:** 1 million
208
+ - **Pretraining tokens:** 4+ trillion
209
+ - **Precision:** bfloat16
210
+
211
+ ## Hardware
212
+
213
+ - **GPUs:** 1024 x H100
214
+
215
+ ## Software
216
+
217
+ - **Framework:** [NeMo Framework](https://www.nvidia.com/en-us/ai-data-science/generative-ai/nemo-framework/)
218
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
219
+
220
+ # License
221
+
222
+ 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).
223
+
224
+ # Citation
225
+
226
+ ```bash
227
+ @misc{lozhkov2024starcoder,
228
+ title={StarCoder 2 and The Stack v2: The Next Generation},
229
+ 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},
230
+ year={2024},
231
+ eprint={2402.19173},
232
+ archivePrefix={arXiv},
233
+ primaryClass={cs.SE}
234
+ }
235
+ ```
config.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Starcoder2Model"
4
+ ],
5
+ "attention_dropout": 0.1,
6
+ "bos_token_id": 0,
7
+ "dtype": "float32",
8
+ "embedding_dropout": 0.1,
9
+ "eos_token_id": 0,
10
+ "hidden_act": "gelu_pytorch_tanh",
11
+ "hidden_size": 6144,
12
+ "initializer_range": 0.01275,
13
+ "intermediate_size": 24576,
14
+ "max_position_embeddings": 16384,
15
+ "mlp_type": "default",
16
+ "model_type": "starcoder2",
17
+ "norm_epsilon": 1e-05,
18
+ "norm_type": "layer_norm",
19
+ "num_attention_heads": 48,
20
+ "num_hidden_layers": 40,
21
+ "num_key_value_heads": 4,
22
+ "pad_token_id": null,
23
+ "quantization_config": {
24
+ "_load_in_4bit": true,
25
+ "_load_in_8bit": false,
26
+ "bnb_4bit_compute_dtype": "bfloat16",
27
+ "bnb_4bit_quant_storage": "uint8",
28
+ "bnb_4bit_quant_type": "nf4",
29
+ "bnb_4bit_use_double_quant": true,
30
+ "llm_int8_enable_fp32_cpu_offload": false,
31
+ "llm_int8_has_fp16_weight": false,
32
+ "llm_int8_skip_modules": null,
33
+ "llm_int8_threshold": 6.0,
34
+ "load_in_4bit": true,
35
+ "load_in_8bit": false,
36
+ "quant_method": "bitsandbytes"
37
+ },
38
+ "residual_dropout": 0.1,
39
+ "rope_parameters": {
40
+ "rope_theta": 100000,
41
+ "rope_type": "default"
42
+ },
43
+ "sliding_window": 4096,
44
+ "tie_word_embeddings": false,
45
+ "transformers_version": "5.3.0.dev0",
46
+ "use_bias": true,
47
+ "use_cache": true,
48
+ "vocab_size": 49152
49
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8ac1a3c782de7ab5b3d5eeea3f1176805e137e7dcbaaef0d0fa87e017502788
3
+ size 9138683742
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "eos_token": "<|endoftext|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|endoftext|>",
10
+ "<fim_prefix>",
11
+ "<fim_middle>",
12
+ "<fim_suffix>",
13
+ "<fim_pad>",
14
+ "<repo_name>",
15
+ "<file_sep>",
16
+ "<issue_start>",
17
+ "<issue_comment>",
18
+ "<issue_closed>",
19
+ "<jupyter_start>",
20
+ "<jupyter_text>",
21
+ "<jupyter_code>",
22
+ "<jupyter_output>",
23
+ "<jupyter_script>",
24
+ "<empty_output>",
25
+ "<code_to_intermediate>",
26
+ "<intermediate_to_code>",
27
+ "<pr>",
28
+ "<pr_status>",
29
+ "<pr_is_merged>",
30
+ "<pr_base>",
31
+ "<pr_file>",
32
+ "<pr_base_code>",
33
+ "<pr_diff>",
34
+ "<pr_diff_hunk>",
35
+ "<pr_comment>",
36
+ "<pr_event_id>",
37
+ "<pr_review>",
38
+ "<pr_review_state>",
39
+ "<pr_review_comment>",
40
+ "<pr_in_reply_to_review_id>",
41
+ "<pr_in_reply_to_comment_id>",
42
+ "<pr_diff_hunk_comment_line>",
43
+ "<NAME>",
44
+ "<EMAIL>",
45
+ "<KEY>",
46
+ "<PASSWORD>"
47
+ ],
48
+ "is_local": false,
49
+ "model_max_length": 1000000000000000019884624838656,
50
+ "pad_token": null,
51
+ "tokenizer_class": "GPT2Tokenizer",
52
+ "unk_token": "<|endoftext|>",
53
+ "vocab_size": 49152
54
+ }