Views
No views yet
model_000404.pt # Model weights
meta_000404.json # Training config and metadata
optim_000404_rank0.pt # Optimizer state
tokenizer/ # BPE tokenizer (tiktoken format) + token byte counts
nanochat/ # Source code to load and run the model1import torch, json
2from nanochat.gpt import GPT, GPTConfig
3from nanochat.tokenizer import RustBPETokenizer
4
5tokenizer = RustBPETokenizer.from_directory("tokenizer")
6
7with open("meta_000404.json") as f:
8 meta = json.load(f)
9
10config = GPTConfig(**meta["model_config"])
11
12with torch.device("meta"):
13 model = GPT(config)
14model.to_empty(device="cuda")
15model.init_weights()
16
17state_dict = torch.load("model_000404.pt", map_location="cuda")
18state_dict = {k.removeprefix("_orig_mod."): v for k, v in state_dict.items()}
19model.load_state_dict(state_dict, strict=True, assign=True)
20model.eval()
21
22bos = tokenizer.get_bos_token_id()
23tokens = tokenizer.encode("The laws of thermodynamics", prepend=bos)
24with torch.amp.autocast(device_type="cuda", dtype=torch.bfloat16):
25 for token in model.generate(tokens, max_tokens=100, temperature=0.8):
26 print(tokenizer.decode([token]), end="", flush=True)torch>=2.9
tiktoken
rustbpemhla/gpt1900-d34-22btok - Base pretrained modelmhla/gpt1900-d34-sft-period - SFT (period style)mhla/gpt1900-d34-sft-modern - SFT (modern style)mhla/gpt1900-d34-rl - RL post-trainingmhla/gpt1900-d34-physics-sft - Physics CLM fine-tuning