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.
Instructions to use rIsHu009/codeparrot-gpt2-accelerate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rIsHu009/codeparrot-gpt2-accelerate with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rIsHu009/codeparrot-gpt2-accelerate")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("rIsHu009/codeparrot-gpt2-accelerate") model = AutoModelForCausalLM.from_pretrained("rIsHu009/codeparrot-gpt2-accelerate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rIsHu009/codeparrot-gpt2-accelerate with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rIsHu009/codeparrot-gpt2-accelerate" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rIsHu009/codeparrot-gpt2-accelerate", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rIsHu009/codeparrot-gpt2-accelerate
- SGLang
How to use rIsHu009/codeparrot-gpt2-accelerate with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "rIsHu009/codeparrot-gpt2-accelerate" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rIsHu009/codeparrot-gpt2-accelerate", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "rIsHu009/codeparrot-gpt2-accelerate" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rIsHu009/codeparrot-gpt2-accelerate", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rIsHu009/codeparrot-gpt2-accelerate with Docker Model Runner:
docker model run hf.co/rIsHu009/codeparrot-gpt2-accelerate
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
Model tree for rIsHu009/codeparrot-gpt2-accelerate
Base model
openai-community/gpt2
docker model run hf.co/rIsHu009/codeparrot-gpt2-accelerate