Record Class LlamaConfig
java.lang.Object
java.lang.Record
io.github.kirstenali.deepj.models.llama.LlamaConfig
- All Implemented Interfaces:
TransformerConfig
public record LlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, float initScale, float gradClipNorm)
extends Record
implements TransformerConfig
-
Constructor Summary
ConstructorsConstructorDescriptionLlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF) Convenience constructor with stable initialization and gradient-clipping defaults.LlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, float gradClipNorm) Convenience constructor retaining the historical gradient-clip argument.LlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, float initScale, float gradClipNorm) Creates an instance of aLlamaConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic intdefaultDFF(int dModel) Returns a common Llama-style dFF for the given dModel:round(8/3 * dModel)rounded up to the nearest multiple of 64.intdFF()Returns the value of thedFFrecord component.intdModel()Returns the value of thedModelrecord component.final booleanIndicates whether some other object is "equal to" this one.floatReturns the value of thegradClipNormrecord component.final inthashCode()Returns a hash code value for this object.floatReturns the value of theinitScalerecord component.intReturns the value of themaxSeqLenrecord component.intnHeads()Returns the value of thenHeadsrecord component.intnLayers()Returns the value of thenLayersrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thevocabSizerecord component.
-
Constructor Details
-
LlamaConfig
public LlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF) Convenience constructor with stable initialization and gradient-clipping defaults. -
LlamaConfig
public LlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, float gradClipNorm) Convenience constructor retaining the historical gradient-clip argument. -
LlamaConfig
public LlamaConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, float initScale, float gradClipNorm) Creates an instance of aLlamaConfigrecord class.- Parameters:
vocabSize- the value for thevocabSizerecord componentmaxSeqLen- the value for themaxSeqLenrecord componentdModel- the value for thedModelrecord componentnHeads- the value for thenHeadsrecord componentnLayers- the value for thenLayersrecord componentdFF- the value for thedFFrecord componentinitScale- the value for theinitScalerecord componentgradClipNorm- the value for thegradClipNormrecord component
-
-
Method Details
-
defaultDFF
public static int defaultDFF(int dModel) Returns a common Llama-style dFF for the given dModel:round(8/3 * dModel)rounded up to the nearest multiple of 64. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
vocabSize
public int vocabSize()Returns the value of thevocabSizerecord component.- Specified by:
vocabSizein interfaceTransformerConfig- Returns:
- the value of the
vocabSizerecord component
-
maxSeqLen
public int maxSeqLen()Returns the value of themaxSeqLenrecord component.- Specified by:
maxSeqLenin interfaceTransformerConfig- Returns:
- the value of the
maxSeqLenrecord component
-
dModel
public int dModel()Returns the value of thedModelrecord component.- Specified by:
dModelin interfaceTransformerConfig- Returns:
- the value of the
dModelrecord component
-
nHeads
public int nHeads()Returns the value of thenHeadsrecord component.- Specified by:
nHeadsin interfaceTransformerConfig- Returns:
- the value of the
nHeadsrecord component
-
nLayers
public int nLayers()Returns the value of thenLayersrecord component.- Specified by:
nLayersin interfaceTransformerConfig- Returns:
- the value of the
nLayersrecord component
-
dFF
public int dFF()Returns the value of thedFFrecord component.- Specified by:
dFFin interfaceTransformerConfig- Returns:
- the value of the
dFFrecord component
-
initScale
public float initScale()Returns the value of theinitScalerecord component.- Returns:
- the value of the
initScalerecord component
-
gradClipNorm
public float gradClipNorm()Returns the value of thegradClipNormrecord component.- Specified by:
gradClipNormin interfaceTransformerConfig- Returns:
- the value of the
gradClipNormrecord component
-