Run this model with HF Jobs

Run codeparrot/codeparrot-small on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/codeparrot/codeparrot-small. Ask me which dataset to train on, then push the LoRA adapter to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs and Transformers to run batch inference with https://huggingface.co/codeparrot/codeparrot-small on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the predictions back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs and Lighteval to evaluate https://huggingface.co/codeparrot/codeparrot-small. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/codeparrot/codeparrot-small with Transformers and bitsandbytes. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

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:

Config Value
Batch size 192
Context size 1024
Training steps 150'000
Gradient accumulation 1
Gradient checkpointing False
Learning rate 5e-4
Weight decay 0.1
Warmup steps 2000
Schedule Cosine

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:

Metric Value
pass@1 3.80%
pass@10 6.57%
pass@100 12.78%

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

Resources

Downloads last month
84,696
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for codeparrot/codeparrot-small

Adapters
21 models
Finetunes
3 models

Datasets used to train codeparrot/codeparrot-small

Spaces using codeparrot/codeparrot-small 9