nanochat Installation
Quick setup for training and inference. nanochat uses uv for fast, reproducible dependency management. Once installed, you can run the speedrun script or any of the individual training and evaluation scripts.
Clone and install
git clone https://github.com/karpathy/nanochat
cd nanochat
uv sync
Requirements
- Python: See
.python-versionin the repo - uv: Install uv if needed; see GitHub for setup
- PyTorch: With CUDA for GPU; installs via uv
- Rust: For tokenizer training (optional)
Activate environment
source .venv/bin/activate
On Windows: .venv\Scripts\activate
Verify
Run a quick check to ensure the package loads:
python -c "import nanochat; print('OK')"
Data setup
Before running the full speedrun, you'll need pretraining data. The runs/speedrun.sh script handles data download and preparation. For custom setups, see datasets and the repo's data handling in nanochat/dataset.py.
Next steps
See getting started to run the speedrun and chat UI. Try the hosted demo at nanochat-ai.com.