Class GPTModel
java.lang.Object
io.github.kirstenali.deepj.models.DecoderOnlyModel
io.github.kirstenali.deepj.models.gpt.GPTModel
- All Implemented Interfaces:
CausalLM,Persistable,Trainable
Minimal GPT-style decoder-only transformer for educational/training use.
Extends DecoderOnlyModel; the only GPT-specific additions are:
- A learned
PositionalEmbeddingadded to the token embedding. - An optional
init-scaleapplied to random weights. LayerNorm1D(instead of RMSNorm) as the final normalisation.
-
Field Summary
Fields inherited from class io.github.kirstenali.deepj.models.DecoderOnlyModel
lmHead, normF, stack, tokEmb -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.github.kirstenali.deepj.models.DecoderOnlyModel
applyInitScale, backward, forward, parametersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.kirstenali.deepj.persistence.Persistable
load, save
-
Constructor Details
-
GPTModel
-
-
Method Details
-
embed
Description copied from class:DecoderOnlyModelMaps input ids to the initial hidden state. Override to add positional embeddings.- Overrides:
embedin classDecoderOnlyModel
-
backwardEmbeddings
Description copied from class:DecoderOnlyModelBack-propagates gradient into embedding layer(s). Override to include positional.- Overrides:
backwardEmbeddingsin classDecoderOnlyModel
-
embeddingParameters
Description copied from class:DecoderOnlyModelReturns all embedding parameters. Override to include positional embedding.- Overrides:
embeddingParametersin classDecoderOnlyModel
-
gradClipNorm
public float gradClipNorm()Description copied from interface:CausalLMGlobal gradient-clipping threshold (e.g.1.0). -
config
-