Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +214 -0
- starcoder2-3b.Q4_0.gguf +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ 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-3b.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
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-3b
|
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: 32.7
|
25 |
+
- task:
|
26 |
+
type: text-generation
|
27 |
+
dataset:
|
28 |
+
name: DS-1000
|
29 |
+
type: ds-1000
|
30 |
+
metrics:
|
31 |
+
- type: pass@1
|
32 |
+
value: 25.0
|
33 |
+
- task:
|
34 |
+
type: text-generation
|
35 |
+
dataset:
|
36 |
+
name: GSM8K (PAL)
|
37 |
+
type: gsm8k-pal
|
38 |
+
metrics:
|
39 |
+
- type: accuracy
|
40 |
+
value: 27.7
|
41 |
+
- task:
|
42 |
+
type: text-generation
|
43 |
+
dataset:
|
44 |
+
name: HumanEval+
|
45 |
+
type: humanevalplus
|
46 |
+
metrics:
|
47 |
+
- type: pass@1
|
48 |
+
value: 27.4
|
49 |
+
- task:
|
50 |
+
type: text-generation
|
51 |
+
dataset:
|
52 |
+
name: HumanEval
|
53 |
+
type: humaneval
|
54 |
+
metrics:
|
55 |
+
- type: pass@1
|
56 |
+
value: 31.7
|
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: 71.19
|
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-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.
|
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-3b"
|
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: 12624.81 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-3b"
|
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: 6312.41 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-3b"
|
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: 3434.07 MB
|
169 |
+
# load_in_4bit
|
170 |
+
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
171 |
+
Memory footprint: 1994.90 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 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.
|
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.2 million
|
187 |
+
- **Pretraining tokens:** 3+ trillion
|
188 |
+
- **Precision:** bfloat16
|
189 |
+
|
190 |
+
## Hardware
|
191 |
+
|
192 |
+
- **GPUs:** 160 A100
|
193 |
+
|
194 |
+
## Software
|
195 |
+
|
196 |
+
- **Framework:** TODO
|
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 |
+
```
|
starcoder2-3b.Q4_0.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c88abdf3db5f15b044d401b3cc6fc8bc03c17801138f6dfc27a8c65c7bdc36f3
|
3 |
+
size 1748817344
|