Upload folder using huggingface_hub (#1)
Browse files- a0e4a17a2fea1fb2828a41a137d1de06c2edb18ebe6eeeae6e889f4bbad5b75e (1ffc7bf133002ceaa5cd3fcda31e304fba88c8bf)
- d5245590b23d53d9ceccbecd102c44dedf3f88989698223f6fa428f01e18a86b (66f190c86f69b81f0051a2ea4a9ae503271c4ddc)
- 5dea59c9118e1e143ab3933f98e10dd3838bf71164c52a60ffa57f1830174af2 (3b5a5ae32645297b0b3aa6176052a67fbeaad1bc)
- d6b0dbc3250b197609b76c70c7739fde4e20b9279fd29e06316f8fbacbd7d915 (a37505e4b89fecc4815f9d9addaf97194a4270d1)
- 2923157105bf0aafacc2904fa7e64cee433909244228acfd7dd1a24089f923d5 (1a4a4742f29c960908ec0afdaa84b4f4315846ac)
- bc083203804bd24c749609de9d63349f87122e2b64ee0ceadc50b647484dfd3c (ed32c25b39976f222c2e90088a70bb877638f99b)
- .gitattributes +5 -0
- README.md +219 -0
- starcoder2-7b_Q3_K_M.gguf +3 -0
- starcoder2-7b_Q4_K_M.gguf +3 -0
- starcoder2-7b_Q5_K_M.gguf +3 -0
- starcoder2-7b_Q6_K.gguf +3 -0
- starcoder2-7b_Q8_0.gguf +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
starcoder2-7b_Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
starcoder2-7b_Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
38 |
+
starcoder2-7b_Q5_K_M.gguf filter=lfs diff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|
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 |
+
datasets:
|
9 |
+
- bigcode/the-stack-v2-train
|
10 |
+
license: bigcode-openrail-m
|
11 |
+
library_name: transformers
|
12 |
+
tags:
|
13 |
+
- code
|
14 |
+
model-index:
|
15 |
+
- name: starcoder2-7b
|
16 |
+
results:
|
17 |
+
- task:
|
18 |
+
type: text-generation
|
19 |
+
dataset:
|
20 |
+
name: CruxEval-I
|
21 |
+
type: cruxeval-i
|
22 |
+
metrics:
|
23 |
+
- type: pass@1
|
24 |
+
value: 34.6
|
25 |
+
- task:
|
26 |
+
type: text-generation
|
27 |
+
dataset:
|
28 |
+
name: DS-1000
|
29 |
+
type: ds-1000
|
30 |
+
metrics:
|
31 |
+
- type: pass@1
|
32 |
+
value: 27.8
|
33 |
+
- task:
|
34 |
+
type: text-generation
|
35 |
+
dataset:
|
36 |
+
name: GSM8K (PAL)
|
37 |
+
type: gsm8k-pal
|
38 |
+
metrics:
|
39 |
+
- type: accuracy
|
40 |
+
value: 40.4
|
41 |
+
- task:
|
42 |
+
type: text-generation
|
43 |
+
dataset:
|
44 |
+
name: HumanEval+
|
45 |
+
type: humanevalplus
|
46 |
+
metrics:
|
47 |
+
- type: pass@1
|
48 |
+
value: 29.9
|
49 |
+
- task:
|
50 |
+
type: text-generation
|
51 |
+
dataset:
|
52 |
+
name: HumanEval
|
53 |
+
type: humaneval
|
54 |
+
metrics:
|
55 |
+
- type: pass@1
|
56 |
+
value: 35.4
|
57 |
+
- task:
|
58 |
+
type: text-generation
|
59 |
+
dataset:
|
60 |
+
name: RepoBench-v1.1
|
61 |
+
type: repobench-v1.1
|
62 |
+
metrics:
|
63 |
+
- type: edit-smiliarity
|
64 |
+
value: 72.07
|
65 |
+
---
|
66 |
+
|
67 |
+
# StarCoder2
|
68 |
+
|
69 |
+
<center>
|
70 |
+
<img src="https://huggingface.co/datasets/bigcode/admin_private/resolve/main/starcoder2_banner.png" alt="SC2" width="900" height="600">
|
71 |
+
</center>
|
72 |
+
|
73 |
+
## Table of Contents
|
74 |
+
|
75 |
+
1. [Model Summary](##model-summary)
|
76 |
+
2. [Use](##use)
|
77 |
+
3. [Limitations](##limitations)
|
78 |
+
4. [Training](##training)
|
79 |
+
5. [License](##license)
|
80 |
+
6. [Citation](##citation)
|
81 |
+
|
82 |
+
## Model Summary
|
83 |
+
|
84 |
+
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.
|
85 |
+
|
86 |
+
- **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)
|
87 |
+
- **Paper:** [Link](https://huggingface.co/papers/2402.19173)
|
88 |
+
- **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)
|
89 |
+
- **Languages:** 17 Programming languages
|
90 |
+
|
91 |
+
## Use
|
92 |
+
|
93 |
+
### Intended use
|
94 |
+
|
95 |
+
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.
|
96 |
+
|
97 |
+
### Generation
|
98 |
+
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).
|
99 |
+
|
100 |
+
First, make sure to install `transformers` from source:
|
101 |
+
```bash
|
102 |
+
pip install git+https://github.com/huggingface/transformers.git
|
103 |
+
```
|
104 |
+
|
105 |
+
#### Running the model on CPU/GPU/multi GPU
|
106 |
+
* _Using full precision_
|
107 |
+
```python
|
108 |
+
# pip install git+https://github.com/huggingface/transformers.git # TODO: merge PR to main
|
109 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
110 |
+
|
111 |
+
checkpoint = "bigcode/starcoder2-7b"
|
112 |
+
device = "cuda" # for GPU usage or "cpu" for CPU usage
|
113 |
+
|
114 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
115 |
+
# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
|
116 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
|
117 |
+
|
118 |
+
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
|
119 |
+
outputs = model.generate(inputs)
|
120 |
+
print(tokenizer.decode(outputs[0]))
|
121 |
+
```
|
122 |
+
```bash
|
123 |
+
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
124 |
+
Memory footprint: 29232.57 MB
|
125 |
+
```
|
126 |
+
* _Using `torch.bfloat16`_
|
127 |
+
```python
|
128 |
+
# pip install accelerate
|
129 |
+
import torch
|
130 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
131 |
+
|
132 |
+
checkpoint = "bigcode/starcoder2-7b"
|
133 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
134 |
+
|
135 |
+
# for fp16 use `torch_dtype=torch.float16` instead
|
136 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
|
137 |
+
|
138 |
+
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
|
139 |
+
outputs = model.generate(inputs)
|
140 |
+
print(tokenizer.decode(outputs[0]))
|
141 |
+
```
|
142 |
+
```bash
|
143 |
+
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
144 |
+
Memory footprint: 14616.29 MB
|
145 |
+
```
|
146 |
+
|
147 |
+
#### Quantized Versions through `bitsandbytes`
|
148 |
+
* _Using 8-bit precision (int8)_
|
149 |
+
|
150 |
+
```python
|
151 |
+
# pip install bitsandbytes accelerate
|
152 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
153 |
+
|
154 |
+
# to use 4bit use `load_in_4bit=True` instead
|
155 |
+
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
156 |
+
|
157 |
+
checkpoint = "bigcode/starcoder2-7b"
|
158 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
159 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
|
160 |
+
|
161 |
+
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
|
162 |
+
outputs = model.generate(inputs)
|
163 |
+
print(tokenizer.decode(outputs[0]))
|
164 |
+
```
|
165 |
+
```bash
|
166 |
+
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
167 |
+
# load_in_8bit
|
168 |
+
Memory footprint: 7670.52 MB
|
169 |
+
# load_in_4bit
|
170 |
+
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
171 |
+
Memory footprint: 4197.64 MB
|
172 |
+
```
|
173 |
+
### Attribution & Other Requirements
|
174 |
+
|
175 |
+
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.
|
176 |
+
|
177 |
+
# Limitations
|
178 |
+
|
179 |
+
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 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.
|
180 |
+
|
181 |
+
# Training
|
182 |
+
|
183 |
+
## Model
|
184 |
+
|
185 |
+
- **Architecture:** Transformer decoder with grouped-query and sliding window attention and Fill-in-the-Middle objective
|
186 |
+
- **Pretraining steps:** 1 million
|
187 |
+
- **Pretraining tokens:** 3.5+ trillion
|
188 |
+
- **Precision:** bfloat16
|
189 |
+
|
190 |
+
## Hardware
|
191 |
+
|
192 |
+
- **GPUs:** 432 H100
|
193 |
+
|
194 |
+
## Software
|
195 |
+
|
196 |
+
- **Framework:** [nanotron](https://github.com/huggingface/nanotron/)
|
197 |
+
- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
|
198 |
+
|
199 |
+
# License
|
200 |
+
|
201 |
+
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).
|
202 |
+
|
203 |
+
# Citation
|
204 |
+
|
205 |
+
```bash
|
206 |
+
@misc{lozhkov2024starcoder,
|
207 |
+
title={StarCoder 2 and The Stack v2: The Next Generation},
|
208 |
+
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},
|
209 |
+
year={2024},
|
210 |
+
eprint={2402.19173},
|
211 |
+
archivePrefix={arXiv},
|
212 |
+
primaryClass={cs.SE}
|
213 |
+
}
|
214 |
+
```
|
215 |
+
|
216 |
+
***
|
217 |
+
|
218 |
+
Quantization of Model [bigcode/starcoder2-7b](https://huggingface.co/bigcode/starcoder2-7b).
|
219 |
+
Created using [llm-quantizer](https://github.com/Nold360/llm-quantizer) Pipeline
|
starcoder2-7b_Q3_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:433bb124c3ab6b740237465ce60ff54c34f3967d1c1e4d294901a57d50ff179b
|
3 |
+
size 3594533696
|
starcoder2-7b_Q4_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:466fd2bcd17e0c67bb80306da866aa966482d046e80f72fd7467217224dba39a
|
3 |
+
size 4402887488
|
starcoder2-7b_Q5_K_M.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a3824726a46758943d57ef1e3f20321c0f0699f5accb649cc33f0e39a8b904e1
|
3 |
+
size 5124832064
|
starcoder2-7b_Q6_K.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:df93cd41a93052d97dc8e7a6df4690a805632d687bf722dcffcfd9ef8cbf7bec
|
3 |
+
size 5891898176
|
starcoder2-7b_Q8_0.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:72a8a59486cdcc8549e5a17a5c5ec66b6ce5db71a9408a2800985791a40fbff0
|
3 |
+
size 7628929856
|