CoolFace
Modelpublic

codeparrot/codeparrot-small-multi

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
9likes409downloads
Model Card

CodeParrot-Multi ๐Ÿฆœ (small)

CodeParrot-Multi ๐Ÿฆœ is a GPT-2 model (110M parameters) trained to generate code in 9 programming languages: "Java", "JavaScript", "PHP", "Python", "C#", "C++", "GO", "Ruby" and "TypeScript".

Usage

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

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

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

or with a pipeline:

Python
from transformers import pipeline

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

Training

The model was trained on the small Github code small after near deduplication, a subset of Github code dataset with the following settings:

ConfigValue
Batch size192
Context size1024
Training steps300'000
Gradient accumulation2
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 58 billion tokens.

Performance

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

MetricValue
pass@1--%
pass@10--%
pass@100--%

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

Resources