codeparrot/codeparrot-small

Model

33

stars

26

commits

6

repos using this model

2

linked in READMEs

Jul 3, 2022

updated

code
endpoints_compatible
generation
gpt2
pytorch
tensorboard
text-generation
text-generation-inference
transformers

README

CodeParrot 🦜 (small)

CodeParrot 🦜 is a GPT-2 model (110M parameters) trained to generate Python code.

Usage

You can load the CodeParrot model and tokenizer directly in transformers:

from transformers import AutoTokenizer, AutoModelWithLMHead
  
tokenizer = AutoTokenizer.from_pretrained("codeparrot/codeparrot-small")
model = AutoModelWithLMHead.from_pretrained("codeparrot/codeparrot-small")

inputs = tokenizer("def hello_world():", return_tensors="pt")
outputs = model(**inputs)

or with a pipeline:

from transformers import pipeline

pipe = pipeline("text-generation", model="codeparrot/codeparrot-small")
outputs = pipe("def hello_world():")

Training

The model was trained on the cleaned CodeParrot 🦜 dataset with the following settings:

ConfigValue
Batch size192
Context size1024
Training steps150'000
Gradient accumulation1
Gradient checkpointingFalse
Learning rate5e-4
Weight decay0.1
Warmup steps2000
ScheduleCosine

The training was executed on 16 x A100 (40GB) GPUs. This setting amounts to roughly 29 billion tokens.

Performance

We evaluated the model on OpenAI's HumanEval benchmark which consists of programming challenges:

MetricValue
pass@13.80%
pass@106.57%
pass@10012.78%

The pass@k metric tells the probability that at least one out of k generations passes the tests.

Resources

Contributors

lvwerra

21 commits

loubnabnl

4 commits

system

1 commits

codeparrot/codeparrot-small

Model

33

stars

26

commits

6

repos using this model

2

linked in READMEs

Jul 3, 2022

updated

code
endpoints_compatible
generation
gpt2
pytorch
tensorboard
text-generation
text-generation-inference
transformers

README

CodeParrot 🦜 (small)

CodeParrot 🦜 is a GPT-2 model (110M parameters) trained to generate Python code.

Usage

You can load the CodeParrot model and tokenizer directly in transformers:

from transformers import AutoTokenizer, AutoModelWithLMHead
  
tokenizer = AutoTokenizer.from_pretrained("codeparrot/codeparrot-small")
model = AutoModelWithLMHead.from_pretrained("codeparrot/codeparrot-small")

inputs = tokenizer("def hello_world():", return_tensors="pt")
outputs = model(**inputs)

or with a pipeline:

from transformers import pipeline

pipe = pipeline("text-generation", model="codeparrot/codeparrot-small")
outputs = pipe("def hello_world():")

Training

The model was trained on the cleaned CodeParrot 🦜 dataset with the following settings:

ConfigValue
Batch size192
Context size1024
Training steps150'000
Gradient accumulation1
Gradient checkpointingFalse
Learning rate5e-4
Weight decay0.1
Warmup steps2000
ScheduleCosine

The training was executed on 16 x A100 (40GB) GPUs. This setting amounts to roughly 29 billion tokens.

Performance

We evaluated the model on OpenAI's HumanEval benchmark which consists of programming challenges:

MetricValue
pass@13.80%
pass@106.57%
pass@10012.78%

The pass@k metric tells the probability that at least one out of k generations passes the tests.

Resources

Contributors

lvwerra

21 commits

loubnabnl

4 commits

system

1 commits