Skip to content

Configuration and CLI

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Command-Line Reference

Run python transformer_from_scratch.py --help for the authoritative parser help.

Argument Default Effect
--smoke-test none Offline synthetic CPU test; mutually exclusive mode
--train none Small Yelp experiment; mutually exclusive mode
--full none Large Yelp preset; mutually exclusive mode
--train-size 1000 Requested train count for --train
--val-size 200 Requested validation count for --train
--test-size 200 Requested test count for --train
--batch-size 8 DataLoader batch size
--max-len 128 Fixed token sequence length
--epochs 2 Training epochs
--n-layers 3 Custom Transformer encoder blocks
--n-heads 6 Attention heads; must divide model width
--dropout 0.05 Dropout probability
--lr 0.0002 AdamW learning rate
--seed 42 Python/PyTorch manual seed
--sdpa off Use PyTorch SDPA attention path
--visualize off Optional torchview/Graphviz PNG
--output project-local transformer_checkpoints/ Checkpoint / visualization directory

Shape constraints

d_model is inferred from the frozen embedding matrix. d_model % n_heads == 0 must hold (384 % 6 == 0 real-data defaults; 48 % 4 == 0 smoke test).

Clone this wiki locally