Views
No views yet
GPT-1900 base (22B tokens pre-1900 text)
→ Physics CLM (continued pretraining on physics texts)
→ Physics SFT
→ Contradiction RL v6 ← you are here| Parameter | Value |
|---|---|
| Parameters | 3.29B |
| Layers | 34 |
| Hidden dim | 2176 |
| Attention heads | 17 (query) / 17 (kv) |
| Head dim | 128 |
| Context length | 2048 tokens |
| Vocab size | 32,768 (BPE, GPT-4 style split pattern) |
0.6; the physics eval uses 0.7 with top_k=50.1import torch, json
2from nanochat.gpt import GPT, GPTConfig
3from nanochat.tokenizer import RustBPETokenizer
4
5tokenizer = RustBPETokenizer.from_directory("tokenizer")
6
7with open("meta_000385.json") as f:
8 meta = json.load(f)
9
10config = GPTConfig(**meta["model_config"])
11with torch.device("meta"):
12 model = GPT(config)
13model.to_empty(device="cuda")
14model.init_weights()
15
16state_dict = torch.load("model_000385.pt", map_location="cuda")
17state_dict = {k.removeprefix("_orig_mod."): v for k, v in state_dict.items()}
18model.load_state_dict(state_dict, strict=True, assign=True)
19model.eval()1bos = tokenizer.get_bos_token_id()
2user_start = tokenizer.encode_special("<|user_start|>")
3user_end = tokenizer.encode_special("<|user_end|>")
4assistant_start = tokenizer.encode_special("<|assistant_start|>")
5
6tokens = [bos, user_start]
7tokens += tokenizer.encode("What is the nature of light?")
8tokens += [user_end, assistant_start]
9
10with torch.amp.autocast(device_type="cuda", dtype=torch.bfloat16):
11 for token in model.generate(tokens, max_tokens=500, temperature=0.8):
12 print(tokenizer.decode([token]), end="", flush=True)torch>=2.9
tiktoken
rustbpe