Sequence Model Examples #
Runnable sequence-model examples, organized by workflow.
Main entrypoints:
CharGpt(torchlean chargpt): Karpathy-style char-level GPT on a single text file (Tiny Shakespeare). This is the teaching path for character tokenization, with separate smoke and lecture presets.Gpt2(torchlean gpt2): byte-level GPT-2-style causal Transformer with a small, local-friendly config. Use this when you want to see masked self-attention + LayerNorm + FFN wiring, and a save/reload path viaGpt2Saved.TextGpt2(torchlean text_gpt2): CUDA-only bounded corpus trainer with byte-level or GPT-2 BPE tokenization. Its BPE path projects observed token IDs into a local output vocabulary.Mamba(torchlean mamba): compact text walkthrough for the Mamba-style model.
Other sequence examples:
RnnandLstm: compact real-text recurrent training checks over the shared corpus-data boundary.Transformer: one-block encoder example for attention/norm/FFN wiring.GptAdder: synthetic algorithmic curriculum (addition), runnable astorchlean gpt_adder.
For supervised time-series forecasting with an LSTM, see
NN.Examples.Models.Supervised.LstmRegression (torchlean lstm_regression).