Class DecoderOnlyModel
java.lang.Object
io.github.kirstenali.deepj.nn.transformer.DecoderOnlyModel
- All Implemented Interfaces:
CausalLM,Persistable,Trainable
- Direct Known Subclasses:
DeepJLoop,DeepJNova,DeepJOrbit,DeepJOrigin,DeepJPrism
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Projectionprotected final NormLayerprotected final TransformerStackprotected final Embedding -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDecoderOnlyModel(Embedding tokEmb, TransformerStack stack, NormLayer normF, Projection lmHead) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidapplyInitScale(float factor) abstract TransformerConfigconfig()protected Tensorembed(int[] inputIds) protected Tensorembed(int[] inputIds, int offset) protected TensorembedBatch(int[][] inputIds) forward(int[] inputIds) forwardBatch(int[][] inputIds) final voidmetadata()final PromptFormatfinal voidfinal voidsetMetadata(Map<String, String> values) final voidsetPromptFormat(PromptFormat format) final booleanprotected booleanprotected booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.kirstenali.deepj.nn.transformer.CausalLM
gradClipNorm
-
Field Details
-
tokEmb
-
stack
-
normF
-
lmHead
-
-
Constructor Details
-
DecoderOnlyModel
protected DecoderOnlyModel(Embedding tokEmb, TransformerStack stack, NormLayer normF, Projection lmHead)
-
-
Method Details
-
config
-
promptFormat
-
setPromptFormat
-
metadata
-
setMetadata
-
save
- Specified by:
savein interfacePersistable- Throws:
IOException
-
load
- Specified by:
loadin interfacePersistable- Throws:
IOException
-
embed
-
embed
-
embedBatch
-
supportsCachedGeneration
protected boolean supportsCachedGeneration() -
supportsRollingGeneration
protected boolean supportsRollingGeneration() -
openGeneration
- Specified by:
openGenerationin interfaceCausalLM
-
openGeneration
- Specified by:
openGenerationin interfaceCausalLM
-
embeddingParameters
-
forward
-
supportsBatchedForward
public final boolean supportsBatchedForward()- Specified by:
supportsBatchedForwardin interfaceCausalLM
-
forwardBatch
- Specified by:
forwardBatchin interfaceCausalLM
-
parameters
- Specified by:
parametersin interfacePersistable- Specified by:
parametersin interfaceTrainable
-
applyInitScale
protected final void applyInitScale(float factor)
-