This is a GPT-2 style model trained with modifications from modded-nanogpt.
1from huggingface_hub import hf_hub_download
2import torch
3from train_gpt2 import GPT, GPTConfig
4import json
5
6# Download config
7config_path = hf_hub_download(repo_id="Elriggs/gpt2-debug-baseline", filename="config.json")
8with open(config_path) as f:
9 config_dict = json.load(f)
10
11# Remove non-GPTConfig fields
12config_dict.pop('step', None)
13
14# Create model
15config = GPTConfig(**config_dict)
16model = GPT(config)
17
18# Download and load weights
19weights_path = hf_hub_download(repo_id="Elriggs/gpt2-debug-baseline", filename="pytorch_model.bin")
20state_dict = torch.load(weights_path, map_location='cpu')
21model.load_state_dict(state_dict)
22
23model.eval()