Causal Transformer Text Example #
Runnable torchlean transformer example. It reads a local text corpus, builds a shifted next-byte
feature sample, and trains a compact causal Transformer on that real text window.
This command uses the same public causal model family as the GPT examples. Future tokens are masked, so a position cannot read the byte it is being trained to predict.
python3 scripts/datasets/download_example_data.py --tiny-shakespeare
lake -R -K cuda=true exe torchlean transformer --device cuda --tiny-shakespeare --steps 1
CLI subcommand name used in terminal banners and error messages.
Instances For
Default JSON loss-curve path for this command.
Instances For
Short multi-token window for the quick encoder training run.
Instances For
Transformer feature width.
Instances For
Default number of distinct corpus windows exposed to the trainer.
Instances For
Compact byte vocabulary: encode byte id b as b % 4; collisions are intentional.
Instances For
Number of attention heads.
Instances For
Per-head width; attentionHeads * attentionHeadWidth = modelWidth.
Instances For
Feed-forward hidden width inside the encoder block.
Instances For
Causal language-model configuration.
Instances For
Input shape: batched one-hot byte buckets.
Instances For
Output shape: one next-byte logit row per token position.
Instances For
Compact causal Transformer used by the runnable text example.
Instances For
Build a finite next-byte dataset from evenly spaced corpus windows.
Instances For
Train the causal Transformer with the public Trainer surface.