Views
No views yet
transformers, no pretrained
components — every layer written from primitives (Stanford CS336 Assignment 1).| Validation loss | 1.375 (perplexity 3.96) |
| Parameters | 22.7M total, ~17M non-embedding |
| Training tokens | 327.7M |
| Hardware | 1x A100 80GB, ~40 min |
transformers architecture. Load with the included model.py:1import json, torch
2from safetensors.torch import load_file
3from model import TransformerLM
4from tokenizer import Tokenizer
5
6cfg = json.load(open("config.json"))
7model = TransformerLM(
8 cfg["vocab_size"], cfg["context_length"], cfg["num_layers"],
9 cfg["d_model"], cfg["num_heads"], cfg["d_ff"], cfg["theta"],
10)
11model.load_state_dict(load_file("model.safetensors"))
12model.eval()
13
14tok = Tokenizer.from_file("ts_vocab.json", "ts_merges.txt", ["<|endoftext|>"])Once upon a timeOnce upon a time, there was a little boy named Tim. He liked to play outside in the sun. One day, he saw a small bird. The bird was sad because it could not fly. Tim wanted to help the bird.