Text Generation
Transformers
PyTorch
code
gpt2
custom_code
Eval Results
text-generation-inference
Inference Endpoints
santacoder / README.md
lvwerra's picture
lvwerra HF staff
Update README.md
600be72
|
raw
history blame
8.04 kB
---
license: openrail
dataset:
- bigcode/the-stack
language:
- code
programming_language:
- Java
- JavaScript
- Python
pipeline_tag: text-generation
widget:
- text: 'def print_hello_world():'
example_title: Hello world
group: Python
model-index:
- name: SantaCoder
results:
- task:
type: text-generation
dataset:
type: openai_humaneval
name: HumanEval (Python)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
verified: false
- task:
type: text-generation
dataset:
type: nuprl/MultiPL-E
name: MultiPL HumanEval (Java)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
- task:
type: text-generation
dataset:
type: nuprl/MultiPL-E
name: MultiPL HumanEval (JavaScript)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
- task:
type: text-generation
dataset:
type: openai_humaneval
name: MBPP (Python)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
verified: false
- task:
type: text-generation
dataset:
type: nuprl/MultiPL-E
name: MultiPL MBPP (Java)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
- task:
type: text-generation
dataset:
type: nuprl/MultiPL-E
name: MultiPL MBPP (JavaScript)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
- task:
type: text-generation
dataset:
type: loubnabnl/humaneval_infilling
name: HumanEval FIM (Python)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
verified: false
- task:
type: text-generation
dataset:
type: nuprl/MultiPL-E
name: MultiPL HumanEval FIM (Java)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
- task:
type: text-generation
dataset:
type: nuprl/MultiPL-E
name: MultiPL HumanEval FIM (JavaScript)
metrics:
- name: pass@1
type: pass@1
value: 0.0
verified: false
- name: pass@10
type: pass@10
value: 0.0
verified: false
- name: pass@100
type: pass@100
value: 0.0
- task:
type: text-generation
dataset:
type: code_x_glue_ct_code_to_text
name: CodeXGLUE code-to-text (Python)
metrics:
- name: BLEU
type: bleu
value: 0.0
verified: false
---
# SantaCoder
![banner](https://huggingface.co/datasets/bigcode/admin/resolve/main/banner.png)
# Table of Contents
1. [Model Summary](#model-summary)
2. [Use](#use)
3. [Limitations](#limitations)
4. [Training](#training)
5. [Citation](#citation)
# Model Summary
The SantaCoder models are a series of 1B parameter models trained on Python, Java, and JavaScript. They were trained on datasets with different filter parameters and with architecture and objective variations. The main model uses multi-query attention, was trained using near-deduplication and commnent-to-code ratio as filtering criteria and using the Fill-in-the-Middle objective.
- **Repository:** [bigcode/Megatron-LM](https://github.com/bigcode-project/Megatron-LM)
- **Project Website:** [bigcode-project.org]www.bigcode-project.org)
- **Paper:** [Coming soon]()
- **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)
- **Languages:** Python, Java, and JavaScript
|Model|Architecture|Objective|Filtering|
|:-|:-|:-|:-|
|`mha`|MHA|AR + FIM| Base |
|`no-fim`| MQA | AR| Base |
|`fim`| MQA | AR + FIM | Base |
|`stars`| MQA | AR + FIM | GitHub stars |
|`fertility`| MQA | AR + FIM | Tokenizer fertility |
|`comments`| MQA | AR + FIM | Comment-to-code ratio |
|`dedup-alt`| MQA | AR + FIM | Stronger near-deduplication |
|`dedup-alt-comments`| MQA | AR + FIM | Stronger near-deduplication and comment-to-code ratio |
The `dedup-alt-comments` model is the best performing model and was trained twice as long 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.
# Use
## Intended use
**Feel free to share your generations in the Community tab!**
## How to use
### Generation
```python
# pip install -q transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "bigcode/santacoder"
device = "cuda" # for GPU usage or "cpu" for CPU usage
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to()
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
```
### Fill-in-the-middle
Fill-in-the-mid uses special tokens to identify the prefix/middle/suffic part of the input and output:
```python
input_text = "<fim-prefix>def print_hello_world():\n <fim-suffix>\n print('Hello world!')<fim-middle>"
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
```
### Load other checkpoints
We upload the checkpoint of each experiment to a seperate branch as well as the intermediate checkpoints as commits on the branches. You can load them with the `revision` flag:
```python
model = AutoModelForCausalLM.from_pretrained(
"bigcode/santacoder",
revision="no-fim", # name of branch or commit hash
trust_remote_code=True
)
```
### Attribution
The pretraining dataset of the model was filtered for permissive licenses only. Nevertheless, the model can generate source code verbatim from the dataset which requires attribution. We provide a [search index](TODO) that let's you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.
# Limitations
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.
# Training
## Model
- **Architecture:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective
- **Pretraining steps:** 600K
- **Pretraining tokens:** 236 billion
- **Precision:** float16
## Hardware
- **GPUs:** 96 Tesla V100
- **Training time:** 6.2 days
- **Total FLOPS:** 2.1 x 10e21
## Software
- **Orchestration:** [Megatron-LM](https://github.com/bigcode-project/Megatron-LM)
- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
- **FP16 if applicable:** [apex](https://github.com/NVIDIA/apex)
# Citation
**TODO**