Downloads · 30 days
0
agoel7029/nano-weather-gpt-model
nano-weather-gpt-model is a machine learning model from agoel7029. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A character-level GPT (~813K parameters) trained from scratch on synthetic weather forecast text.
Downloads · 30 days
0
Access
Public
Updated Jun 1, 2026
Repo size
3.5 MB
Likes
0
Public
Click a slice to open those files.
.pt3.5 MB · 100%
From the Hugging Face model README
A character-level GPT (~813K parameters) trained from scratch on synthetic weather forecast text.
from huggingface_hub import snapshot_download
import torch, pickle, sys
# Download all files
path = snapshot_download("agoel7029/nano-weather-gpt-model")
sys.path.insert(0, path)
from model import GPT
ckpt = torch.load(f"{path}/model.pt", map_location="cpu", weights_only=False)
meta = pickle.load(open(f"{path}/meta.pkl", "rb"))
stoi, itos = meta["stoi"], meta["itos"]
model = GPT(ckpt["config"])
model.load_state_dict(ckpt["model_state_dict"])
model.eval()
prompt = "Today the weather is"
ctx = torch.tensor([[stoi[c] for c in prompt]], dtype=torch.long)
with torch.no_grad():
out = model.generate(ctx, max_new_tokens=200)
print("".join(itos[i] for i in out[0].tolist()))
Edit train.py — replace generate_weather_corpus() with your own text, then run:
python train.py
| Property | Value |
|---|---|
| Architecture | Character-level GPT (Transformer) |
| Parameters | ~813K |
| Layers | 4 |
| Attention heads | 4 |
| Embedding dim | 128 |
| Context length | 128 characters |
| Trained on | Synthetic Swiss city weather reports |