Package smile.llm
Record Class Transformer.Options
java.lang.Object
java.lang.Record
smile.llm.Transformer.Options
- Record Components:
numTokens
- the number of tokens in the vocabulary.dModel
- the number of expected features in the encoder/decoder inputs (default=512).numHeads
- the number of heads in the attention models (default=8).numEncoderLayers
- the number of sub-encoder-layers in the encoder (default=6).numDecoderLayers
- the number of sub-decoder-layers in the decoder (default=6).dimFeedForward
- the dimension of the feedforward network model (default=2048).dropout
- the dropout value (default=0.1).activation
- the activation function of encoder/decoder intermediate layer, e.g. "relu" or "gelu" (default=relu).
- Enclosing class:
Transformer
public static record Transformer.Options(int numTokens, int dModel, int numHeads, int numEncoderLayers, int numDecoderLayers, int dimFeedForward, double dropout, String activation)
extends Record
Transformer architecture configuration.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactivation
record component.int
Returns the value of thedimFeedForward
record component.int
dModel()
Returns the value of thedModel
record component.double
dropout()
Returns the value of thedropout
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of thenumDecoderLayers
record component.int
Returns the value of thenumEncoderLayers
record component.int
numHeads()
Returns the value of thenumHeads
record component.int
Returns the value of thenumTokens
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Options
public Options(int numTokens) Constructor with default values.- Parameters:
numTokens
- the number of tokens in the vocabulary.
-
Options
public Options(int numTokens, int dModel, int numHeads, int numEncoderLayers, int numDecoderLayers, int dimFeedForward, double dropout, String activation) Creates an instance of aOptions
record class.- Parameters:
numTokens
- the value for thenumTokens
record componentdModel
- the value for thedModel
record componentnumHeads
- the value for thenumHeads
record componentnumEncoderLayers
- the value for thenumEncoderLayers
record componentnumDecoderLayers
- the value for thenumDecoderLayers
record componentdimFeedForward
- the value for thedimFeedForward
record componentdropout
- the value for thedropout
record componentactivation
- the value for theactivation
record 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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
numTokens
public int numTokens()Returns the value of thenumTokens
record component.- Returns:
- the value of the
numTokens
record component
-
dModel
public int dModel()Returns the value of thedModel
record component.- Returns:
- the value of the
dModel
record component
-
numHeads
public int numHeads()Returns the value of thenumHeads
record component.- Returns:
- the value of the
numHeads
record component
-
numEncoderLayers
public int numEncoderLayers()Returns the value of thenumEncoderLayers
record component.- Returns:
- the value of the
numEncoderLayers
record component
-
numDecoderLayers
public int numDecoderLayers()Returns the value of thenumDecoderLayers
record component.- Returns:
- the value of the
numDecoderLayers
record component
-
dimFeedForward
public int dimFeedForward()Returns the value of thedimFeedForward
record component.- Returns:
- the value of the
dimFeedForward
record component
-
dropout
public double dropout()Returns the value of thedropout
record component.- Returns:
- the value of the
dropout
record component
-
activation
Returns the value of theactivation
record component.- Returns:
- the value of the
activation
record component
-