Record Class DeepSeekConfig
java.lang.Object
java.lang.Record
io.github.kirstenali.deepj.models.deepseek.DeepSeekConfig
- All Implemented Interfaces:
TransformerConfig
public record DeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank, float initScale, float gradClipNorm)
extends Record
implements TransformerConfig
Configuration for a DeepSeek-style decoder-only transformer.
Extends the shared TransformerConfig fields with two MLA-specific ranks:
qRank— Q latent dimension (e.g.dModel / 2)kvRank— KV latent dimension (e.g.dModel / 4)
-
Constructor Summary
ConstructorsConstructorDescriptionDeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank) Convenience constructor with stable initialization and gradient-clipping defaults.DeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank, float gradClipNorm) Convenience constructor retaining the historical gradient-clip argument.DeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank, float initScale, float gradClipNorm) Creates an instance of aDeepSeekConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintdFF()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.intkvRank()Returns the value of thekvRankrecord component.intReturns the value of themaxSeqLenrecord component.intnHeads()Returns the value of thenHeadsrecord component.intnLayers()Returns the value of thenLayersrecord component.intqRank()Returns the value of theqRankrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thevocabSizerecord component.
-
Constructor Details
-
DeepSeekConfig
public DeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank) Convenience constructor with stable initialization and gradient-clipping defaults. -
DeepSeekConfig
public DeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank, float gradClipNorm) Convenience constructor retaining the historical gradient-clip argument. -
DeepSeekConfig
public DeepSeekConfig(int vocabSize, int maxSeqLen, int dModel, int nHeads, int nLayers, int dFF, int qRank, int kvRank, float initScale, float gradClipNorm) Creates an instance of aDeepSeekConfigrecord 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 componentqRank- the value for theqRankrecord componentkvRank- the value for thekvRankrecord componentinitScale- the value for theinitScalerecord componentgradClipNorm- the value for thegradClipNormrecord component
-
-
Method Details
-
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
-
qRank
public int qRank()Returns the value of theqRankrecord component.- Returns:
- the value of the
qRankrecord component
-
kvRank
public int kvRank()Returns the value of thekvRankrecord component.- Returns:
- the value of the
kvRankrecord 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
-