Downloads · 30 days
0
gaviego/nanochat
nanochat is a text generation model from gaviego. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as mit.
Supervised fine-tuned language model from the nanochat project by Andrej Karpathy.
Downloads · 30 days
0
Access
Public
Updated Nov 15, 2025
Repo size
2.1 GB
Likes
1
Public
Click a slice to open those files.
.pt2.1 GB · 100%
From the Hugging Face model README
Supervised fine-tuned language model from the nanochat project by Andrej Karpathy.
"The best ChatGPT that $100 can buy"
This model was trained using the nanochat pipeline, which includes:
Training cost: ~$100 on 8xH100 GPUs (~4 hours total)
# Clone and store the path
git clone https://github.com/karpathy/nanochat
cd nanochat
NANOCHAT_DIR=$(pwd)
# Install dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
# Download files
mkdir -p ~/.cache/nanochat/chatsft_checkpoints/d20
mkdir -p ~/.cache/nanochat/tokenizer
cd ~/.cache/nanochat/tokenizer
wget https://huggingface.co/gaviego/nanochat/resolve/main/tokenizer.pkl
cd ~/.cache/nanochat/chatsft_checkpoints/d20
wget https://huggingface.co/gaviego/nanochat/resolve/main/model_000700.pt
wget https://huggingface.co/gaviego/nanochat/resolve/main/meta_000700.json
# Return to nanochat directory
cd "$NANOCHAT_DIR"
source .venv/bin/activate
python -m scripts.chat_cli
import torch
from nanochat.checkpoint_manager import build_model
# Path to checkpoint directory
checkpoint_dir = "~/.cache/nanochat/chatsft_checkpoints/d20"
step = 700
device = torch.device("cpu") # or "cuda"
# Load model
model, tokenizer, meta = build_model(checkpoint_dir, step, device, phase="eval")
# Generate text
from nanochat.engine import Engine
engine = Engine(model, tokenizer, device=device)
response = engine.generate("Hello, how are you?", max_new_tokens=100)
print(response)
from huggingface_hub import hf_hub_download
# Download checkpoint
model_path = hf_hub_download(
repo_id="gaviego/nanochat",
filename="model_000700.pt"
)
meta_path = hf_hub_download(
repo_id="gaviego/nanochat",
filename="meta_000700.json"
)
model_000700.pt (2.0GB) - PyTorch model checkpoint with weightsmeta_000700.json (264 bytes) - Training metadata and hyperparametersAs a micro-scale language model trained on a $100 budget:
If you use this model, please cite the nanochat project:
@misc{nanochat,
author = {Andrej Karpathy},
title = {nanochat: The best ChatGPT that $100 can buy},
year = {2025},
publisher = {GitHub},
url = {https://github.com/karpathy/nanochat}
}
MIT License (same as nanochat)