Skip to content

Minimal GPT training codebase that reproduces GPT-2 (124M) for learning transformers from scratch.

CCM score
61 of 100
skills.sh installs
1.1K
GitHub stars
14.9K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers character-level training on Shakespeare for CPU runs and GPT-2 (124M) reproduction on OpenWebText across multiple GPUs
  • Includes a model file and training loop of roughly 300 lines each, plus config files for Shakespeare, GPT-2, and fine-tuning from OpenAI checkpoints
  • Provides workflows for custom datasets and for fine-tuning pretrained gpt2 weights, with torchrun for distributed data parallel training
  • Designed for learners and educators who want hackable PyTorch code without abstraction layers, and for quick prototyping on limited compute

Install

$ npx -y skills add orchestra-research/ai-research-skills --skill nanogpt -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

nanoGPT - Minimalist GPT Training

Quick start

nanoGPT is a simplified GPT implementation designed for learning and experimentation.

Installation:

pip install torch numpy transformers datasets tiktoken wandb tqdm

Train on Shakespeare (CPU-friendly):

# Prepare data
python data/shakespeare_char/prepare.py

# Train (5 minutes on CPU)
python train.py config/train_shakespeare_char.py

# Generate text
python sample.py --out_dir=out-shakespeare-char

Output:

ROMEO:
What say'st thou? Shall I speak, and be a man?

JULIET:
I am afeard, and yet I'll speak; for thou art
One that hath been a man, and yet I know not
What thou art.

Common workflows

Workflow 1: Character-level Shakespeare

Complete training pipeline:

# Step 1: Prepare data (creates train.bin, val.bin)
python data/shakespeare_char/prepare.py

# Step 2: Train small model
python train.py config/train_shakespeare_char.py

# Step 3: Generate text
python sample.py --out_dir=out-shakespeare-char

Details

Repository
github.com/orchestra-research/ai-research-skills
Categories
Data Science & Analytics, Learning & Teaching
First seen
Jun 3, 2026

Questions

What does the nanogpt skill do?

The nanogpt skill guides an agent through Andrej Karpathy's educational GPT implementation of about 300 lines, which reproduces GPT-2 (124M) on OpenWebText. It covers training on Shakespeare on a CPU, training on OpenWebText across multiple GPUs, and fine-tuning from pretrained GPT-2 weights.

How do I install the nanogpt skill?

Run npx -y skills add orchestra-research/ai-research-skills --skill nanogpt -y in your project. Once installed, the agent can walk you through training a small character-level model on Shakespeare or reproducing GPT-2 (124M) from scratch.

Which skills lead the Data Science & Analytics category?

nanogpt sits in the Data Science & Analytics category on Claude Marketplaces, alongside azure-kusto, analyze-project, run-train, explore-run and add-analytics-instrumentation. Its focus is on learning transformer architecture from scratch rather than analytics tooling.

What do I need to run the nanogpt skill?

You need PyTorch, numpy, transformers, datasets, tiktoken, wandb and tqdm, installed with pip. A CPU is enough for the Shakespeare run, which takes about 5 minutes, while GPT-2 (124M) training needs GPUs, for example 8 A100s for about 4 days.

More from orchestra-research/ai-research-skills

All 92