Run this model with HF Jobs

Run rIsHu009/codeparrot-gpt2-accelerate 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/rIsHu009/codeparrot-gpt2-accelerate. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

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

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/rIsHu009/codeparrot-gpt2-accelerate. 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/rIsHu009/codeparrot-gpt2-accelerate. 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.
How to use from
Docker Model Runner
docker model run hf.co/rIsHu009/codeparrot-gpt2-accelerate
Quick Links

CodeParrot GPT-2 β€” Accelerate Experiment

A GPT-2-style causal language model for code generation, trained as part of my hands-on study of lower-level Transformer training with Hugging Face Accelerate.

This checkpoint represents the Accelerate/manual-training counterpart to my Hugging Face Trainer experiment:

➑️ rIsHu009/codeparrot-gpt2-trainer

This repository is preserved as an educational training artifact rather than presented as a production code-generation model.

Experiment

The purpose of this experiment was to move below the high-level Trainer abstraction and explore more direct control over language-model training.

source code
    ↓
code-oriented BPE tokenizer
    ↓
GPT-2 causal language model
    ↓
Accelerate training workflow
    ↓
next-token prediction

Together, the Trainer and Accelerate repositories document two approaches to training the same class of causal language model.

Model Architecture

Property Value
Architecture GPT2LMHeadModel
Task Causal Language Modeling / Text Generation
Transformer layers 12
Hidden size 768
Attention heads 12
Vocabulary size 50,000
Training context length 128 tokens
Maximum position embeddings 1,024
Weight precision FP32
Activation GELU New

The saved configuration identifies a standard GPT-2 causal-language-model head with a code-oriented tokenizer.

Tokenizer

The repository contains a 50,000-token Byte-Level BPE tokenizer designed around source-code text.

Its vocabulary contains common programming structures and terms such as:

def
return
self
None
value
file
data
error
config

The tokenizer uses <|endoftext|> as its beginning/end-of-sequence token.

Accelerate Training

Unlike the companion model, this repository was produced through an Accelerate-oriented training workflow rather than Hugging Face Trainer.

The repository history preserves training progress through step 40,000.

Accelerate provides lower-level control over the training process while helping manage concerns such as:

  • device placement;
  • mixed-precision workflows;
  • distributed execution;
  • gradient synchronization;
  • model preparation;
  • optimizer and dataloader preparation.

This made the experiment useful for understanding what occurs beneath higher-level training abstractions.

Quick Start

from transformers import AutoTokenizer, AutoModelForCausalLM

MODEL_ID = "rIsHu009/codeparrot-gpt2-accelerate"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(MODEL_ID)

prompt = """def fibonacci(n):
    if n <= 1:
"""

inputs = tokenizer(
    prompt,
    return_tensors="pt",
)

outputs = model.generate(
    **inputs,
    max_new_tokens=80,
    do_sample=True,
    temperature=0.8,
    top_p=0.95,
)

print(
    tokenizer.decode(
        outputs[0],
        skip_special_tokens=True,
    )
)

Trainer vs Accelerate

This model is most useful when viewed alongside its companion checkpoint:

Repository Training approach
codeparrot-gpt2-trainer Hugging Face Trainer
codeparrot-gpt2-accelerate Accelerate/manual training workflow

Trainer

The Trainer version demonstrates Hugging Face's higher-level training abstraction, where much of the optimization loop, logging, checkpointing, and training infrastructure is managed automatically.

Accelerate

This version represents a more explicit workflow where the training loop is exposed while Accelerate handles much of the underlying hardware and distributed-training complexity.

The pair is retained intentionally as a learning comparison rather than as duplicate model repositories.

Intended Use

This checkpoint is primarily useful for:

  • learning causal language modeling;
  • experimenting with code generation;
  • understanding code-oriented tokenization;
  • studying Hugging Face Accelerate;
  • learning manual Transformer training loops;
  • comparing Accelerate with Trainer;
  • educational GPT-2 inference experiments.

Evaluation

No verified benchmark results were preserved with this checkpoint.

Therefore, this card intentionally does not claim pass@k, perplexity, code correctness, or other unsupported performance metrics.

The model should be treated as an educational checkpoint rather than a benchmarked code-generation system.

Limitations

Generated code may:

  • contain syntax errors;
  • contain logical bugs;
  • hallucinate APIs or libraries;
  • produce incomplete functions;
  • reproduce undesirable patterns from training data;
  • contain insecure or inefficient implementations.

Any generated code should be inspected and tested before execution.

The model's relatively small scale and short training context also limit its ability to reason over large programs or long dependencies.

Learning Context

This checkpoint was created during hands-on study of Hugging Face language-model training.

The progression represented by these repositories includes moving from:

pretrained Transformers
        ↓
task fine-tuning
        ↓
causal language modeling
        ↓
custom tokenization
        ↓
Trainer
        ↓
Accelerate / explicit training loops

The repositories are retained as reproducible learning artifacts documenting that progression.

Repository Contents

The repository includes:

  • GPT-2 model configuration;
  • model.safetensors;
  • 50k-token BPE tokenizer;
  • tokenizer vocabulary and merges;
  • generation configuration;
  • saved Accelerate-trained checkpoint.

Companion Model

Trainer implementation

rIsHu009/codeparrot-gpt2-trainer

That repository preserves the corresponding high-level Hugging Face Trainer workflow and its historical training configuration.

Author

Naman Chanana

  • Hugging Face: rIsHu009
  • GitHub: Rishy-09

Educational code-language-model artifact preserved as part of an ongoing study of LLM training and the Hugging Face ecosystem.

Downloads last month
221
Safetensors
Model size
0.1B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for rIsHu009/codeparrot-gpt2-accelerate

Finetuned
(2,350)
this model

Collection including rIsHu009/codeparrot-gpt2-accelerate