MCPcopy Create free account

hub / github.com/alan-cooney/transformer-from-scratch / types & classes

Types & classes26 in github.com/alan-cooney/transformer-from-scratch

↓ 15 callersClassTransformerConfig
Transformer Config Defaults to GPT2
transformer_from_scratch/components/config.py:5
↓ 6 callersClassSinusoidalPositionalEncoding
Sinusoidal Positional Encoding Module. The purpose of positional encoding is to add information about the relative positions of tokens within
transformer_from_scratch/components/positional_encoding.py:15
↓ 5 callersClassTransformer
Encoder Only Transformer.
transformer_from_scratch/transformer.py:17
↓ 4 callersClassMultiHeadAttention
Multi-Head Attention Module. This module takes an input residual stream and applies multiple attention heads that operate in parallel to proc
transformer_from_scratch/components/attention.py:26
↓ 4 callersClassMyDataset
Test Dataset.
transformer_from_scratch/tests/test_train.py:39
↓ 2 callersClassEmbed
Embedding Module. Embedding involves taking each token, and embedding it from the high-dimensional vocabulary space (which can be of size e.g
transformer_from_scratch/components/embed_unembed.py:18
↓ 2 callersClassLayer
Full layer (attention + feed forward). The layer receives the residual stream as an input. It then applies the multi-head attention sub-layer
transformer_from_scratch/components/layer.py:10
↓ 2 callersClassMLP
MLP The MLP module takes an input of the residual stream and applies a standard two-layer feed forward network. The resulting output will the
transformer_from_scratch/components/mlp.py:21
↓ 2 callersClassSimpleModel
Simple model for testing.
transformer_from_scratch/tests/test_train.py:16
↓ 2 callersClassUnembed
Unembedding Module. Unembedding involves taking each token at the end of the residual stream, and "unembedding" it from the low-dimensional r
transformer_from_scratch/components/embed_unembed.py:74
↓ 1 callersClassFlaggedToken
Flagged Token Dataset Dataset designed to test that the model can learn to attend to a token, and that it can learn a what to do after attend
transformer_from_scratch/components/tests/test_attention.py:88
↓ 1 callersClassUnorderedIntegersDataset
Ordered integers dataset. The samples are contiguous sets of numbers (e.g. {3,1,2,4,0}). The targets are simply the next numbers after this (
transformer_from_scratch/components/tests/test_embed_unembed.py:35
↓ 1 callersClassZeroLayerModel
Zero Layer Model. Contains just embedding and unembedding layers.
transformer_from_scratch/components/tests/test_embed_unembed.py:79
ClassBitReversalDataset
Bit Reversal Dataset. The model should learn to reverse the order of the input bits. For example, if the input is [0, 1, 1, 0, 1, 0, 0, 1, 0,
transformer_from_scratch/components/tests/test_mlp.py:60
ClassIdentityDataset
Identity Dataset. The model should learn to output the same input values. Each input neuron is connected to the corresponding output neuron.
transformer_from_scratch/components/tests/test_mlp.py:48
ClassOddEvenDataset
Odd Even Dataset. The model should learn to separate the input bits based on their index (odd or even). The output should have the odd-indexe
transformer_from_scratch/components/tests/test_mlp.py:75
ClassRegressionTaskDataset
Regression task dataset. Extend this to add datasets that the model should be able to learn.
transformer_from_scratch/components/tests/test_mlp.py:18
ClassStrEnum
Backwards compatible string enum.
transformer_from_scratch/types.py:16
ClassTensorShapeLabels
Tensor Shape Labels Labels (aka dimension names) used in describing tensors.
transformer_from_scratch/types.py:20
ClassTestAttentionCalculation
Attention Calculation Tests.
transformer_from_scratch/components/tests/test_attention.py:50
ClassTestDevice
Default device tests.
transformer_from_scratch/tests/test_train.py:53
ClassTestEvaluate
Evaluate tests.
transformer_from_scratch/tests/test_train.py:64
ClassTestMask
Attention Mask Tests.
transformer_from_scratch/components/tests/test_attention.py:30
ClassTestMultiHeadAttention
Multi-Head Attention Module Tests.
transformer_from_scratch/components/tests/test_attention.py:137
ClassTestTensorShapeLabels
TensorShapeLabels tests.
transformer_from_scratch/tests/test_types.py:5
ClassTestTrainLoop
Train loop tests.
transformer_from_scratch/tests/test_train.py:90