Downloads · 30 days
0
adithyarama/nanoGPT_hw_t4
nanoGPT_hw_t4 is a text generation model from adithyarama. Use it when you need the model to write or continue text. The card lists the license as mit.
A 165M parameter LLaMA-style nanoGPT model trained for five-sentence commonsense story completion on ROCStories, developed for the COMP4680/8650 Advanced Topics in Machine Learning assignment at the Australian Nationa…
Downloads · 30 days
0
Access
Public
Updated Apr 1, 2026
Repo size
1.5 GB
Likes
0
Public
Click a slice to open those files.
.pt1.5 GB · 100%
From the Hugging Face model README
A 165M parameter LLaMA-style nanoGPT model trained for five-sentence commonsense story completion on ROCStories, developed for the COMP4680/8650 Advanced Topics in Machine Learning assignment at the Australian National University (2026 S1).
Modern LLaMA-style GPT with all four architectural improvements enabled:
| Component | Choice |
|---|---|
| Positional encoding | RoPE (Rotary Position Embedding) |
| Normalisation | RMSNorm (no bias) |
| Feed-forward | SwiGLU (8/3 × hidden dim) |
| Attention stability | QK-Norm (RMSNorm on Q and K) |
| Parameters | 123.59M |
| Block size | 512 tokens |
| Vocab size | 50,304 (GPT-2 BPE, tiktoken) |
Stage 1 — Pretraining (25,000 steps)
out-t4-pretrain/ckpt_best.ptStage 2 — Fine-tuning (30,000 additional steps, total 55,000)
rocstories_synthetic — 408,722 synthetic ROCStories generated
by llama-3.3-70b (Groq API) and llama3:8b (local Ollama), covering
28 culturally diverse categories (South Asian, East Asian, African,
Latin American, Middle Eastern, workplace narratives, etc.)
always_save_checkpoint = True (val loss rises during Stage 2 by design —
this reflects distribution shift from TinyStories to ROCStories, not overfitting)Included in sample_params.json:
{
"temperature": 0.80,
"top_k": 50,
"top_p": 0.92,
"repetition_penalty": 1.03,
"stop_token": 50256
}
Load and use with the provided sample_batch.py.
Prompt: Emily forgot her umbrella before leaving for work.
Emily forgot her umbrella before leaving for work. She walked quickly to the office building, trying not to get wet. On her way, she stopped at a store to buy a cheap umbrella. The new umbrella turned out to be very sturdy and kept her dry. Emily arrived at the office, feeling relieved and grateful for her new umbrella.
Prompt: Tom decided to cook dinner for his friends.
Tom decided to cook dinner for his friends. He spent the evening following a complicated recipe he found online. Halfway through cooking, he realized he had forgotten to buy one of the key ingredients. Tom improvised with what he had and hoped for the best flavor combination. His friends enjoyed the meal and appreciated the effort he put into cooking for them.
Prompt: Sarah lost her keys on the way to the grocery store.
Sarah lost her keys on the way to the grocery store. She had been shopping for hours and still couldn't find them anywhere. Sarah started to feel frustrated and worried about being late for her dinner plans. She decided to retrace her steps from the previous day to see if she dropped them. After a short walk, she finally found the keys on a bench and continued shopping.
| Metric | Value |
|---|---|
| Stage 1 best val PPL | 1.7 (on combined ROCStories+TinyStories val) |
| Stage 2 val PPL | Rising (26→50+) — expected, reflects distribution shift away from TinyStories |
| Story quality | 5/5 sentences, coherent arcs on all 8 test prompts |
Note: Stage 2 val PPL rising is intentional and expected. The model
is shifting its distribution from TinyStories (childlike) toward adult
ROCStories style. The stored best_val_loss in the checkpoint reflects
Stage 1 metrics and is not meaningful for Stage 2 story quality.
# Load checkpoint
import torch
from model import GPT, GPTConfig
import json
ckpt = torch.load('ckpt.pt', map_location='cpu', weights_only=False)
cfg = GPTConfig(**ckpt['model_args'])
model = GPT(cfg)
state_dict = {k.replace('_orig_mod.', ''): v for k, v in ckpt['model'].items()}
model.load_state_dict(state_dict)
model.eval()
# Or just use the provided scripts:
# python sample_batch.py --init_from=resume --out_dir=. \
# --start=FILE:data/rocstories/eval_prompts.txt \
# --batch_prompts=True --max_new_tokens=120
@misc{karpathy2022nanogpt,
author = {Karpathy, Andrej},
title = {nanoGPT},
year = {2022},
url = {https://github.com/karpathy/nanoGPT}
}