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 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 a Options record class.
      Parameters:
      numTokens - the value for the numTokens record component
      dModel - the value for the dModel record component
      numHeads - the value for the numHeads record component
      numEncoderLayers - the value for the numEncoderLayers record component
      numDecoderLayers - the value for the numDecoderLayers record component
      dimFeedForward - the value for the dimFeedForward record component
      dropout - the value for the dropout record component
      activation - the value for the activation record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • numTokens

      public int numTokens()
      Returns the value of the numTokens record component.
      Returns:
      the value of the numTokens record component
    • dModel

      public int dModel()
      Returns the value of the dModel record component.
      Returns:
      the value of the dModel record component
    • numHeads

      public int numHeads()
      Returns the value of the numHeads record component.
      Returns:
      the value of the numHeads record component
    • numEncoderLayers

      public int numEncoderLayers()
      Returns the value of the numEncoderLayers record component.
      Returns:
      the value of the numEncoderLayers record component
    • numDecoderLayers

      public int numDecoderLayers()
      Returns the value of the numDecoderLayers record component.
      Returns:
      the value of the numDecoderLayers record component
    • dimFeedForward

      public int dimFeedForward()
      Returns the value of the dimFeedForward record component.
      Returns:
      the value of the dimFeedForward record component
    • dropout

      public double dropout()
      Returns the value of the dropout record component.
      Returns:
      the value of the dropout record component
    • activation

      public String activation()
      Returns the value of the activation record component.
      Returns:
      the value of the activation record component