nanoGPT Quick Start Guide (Apple Silicon M3)

Optimized for local training on your M3 iMac using Metal Performance Shaders (MPS).

Step 1: Install Dependencies

Open your terminal and install the required Python packages:

pip install torch numpy transformers datasets tiktoken wandb tqdm

Step 2: Prepare the Dataset

Download and tokenize the Shakespeare character dataset:

python data/shakespeare_char/prepare.py

Step 3: Train the Model Locally (MPS)

Train your character-level GPT using your Mac's integrated GPU hardware acceleration:

python train.py config/train_shakespeare_char.py --device=mps --compile=False

Step 4: Sample / Inference

Generate text samples from your newly trained checkpoint:

python sample.py --out_dir=out-shakespeare-char --device=mps