Mamba Text Training #
Runnable byte-level language-model training with the public Mamba API constructor.
The model is trainable end-to-end:
mamba(contextLength, vocabularySize, stateWidth) → linear(stateWidth → vocabularySize)
and the same code runs on CPU or CUDA through TorchLean autograd.
python3 scripts/datasets/download_example_data.py --tiny-shakespeare
lake -R -K cuda=true exe torchlean mamba --device cuda --tiny-shakespeare --steps 1 --windows 1 \
--generate 0
CLI subcommand name used in terminal banners and error messages.
Instances For
Default JSON loss-curve path for this command.
Instances For
Complete command help, including the text and training flags parsed after runtime selection.
Instances For
Training and generation context length for the Mamba text example.
Instances For
Byte tokenizer used by this sequence model.
Instances For
Number of byte-token classes.
Instances For
Width of each token embedding and of the Mamba block's output.
Instances For
Byte value used to pad short text windows.
Instances For
Mamba text-model configuration shared by shapes and the constructor.
Instances For
Embed a byte id in the complete 256-entry byte vocabulary.
Instances For
Input shape: one sequence of one-hot byte tokens.
Instances For
Output shape: one vocabulary-logit row per input position.
Instances For
Public Mamba language-model constructor specialized to the example config.
Instances For
Command-local training, sampling, and corpus-window controls.
- training : TorchLean.CLI.Training.OptimizerOptions
Optimizer, step, batching, and logging controls.
- generation : TorchLean.text.GenerationOptions
Prompt and token-sampling policy.
- window : TorchLean.text.WindowOptions
Number of corpus windows exposed to training.
Instances For
Instances For
Convert a token window into the one-hot next-token sample consumed by the Mamba model.
Instances For
Build a finite training set from approximately evenly spaced corpus windows.
Instances For
Print the current argmax prediction beside the prompt and shifted target text.
Instances For
Convert a prompt window into the typed one-hot input tensor used during generation.
Instances For
Autoregressively extend a prompt using the trained Mamba parameters.
Instances For
Train the Mamba language model and print before/after prediction and generation reports.