Transformer class

A complete decoder-only Transformer model (GPT-style).

Inheritance

Constructors

Transformer({int vocabSize = 50, int embedSize = 32, int blockSize = 8, int numLayers = 4, int numHeads = 4})

Properties

blocks List<TransformerBlock>
final
blockSize int
final
embedSize int
final
finalLayerNorm LayerNorm
final
hashCode int
The hash code for this object.
no setterinherited
lmHead Layer
final
numHeads int
final
numLayers int
final
positionEmbeddings List<ValueVector>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tokenEmbeddings List<ValueVector>
final
vocabSize int
final

Methods

forward(List<int> idx) List<ValueVector>
The forward pass for the entire Transformer model.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parameters() List<Value>
override
toString() String
A string representation of this object.
inherited
zeroGrad() → void
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited