Class SearchConfig

java.lang.Object
ai.djl.modality.nlp.generate.SearchConfig

public class SearchConfig extends Object
SearchConfig is a class whose fields are parameters used for autoregressive search / text generation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new ContrastiveSearchConfig instance with default values.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the alpha.
    int
    Returns the value of the beam.
    long
    Returns the value of the eosTokenId.
    int
    Returns the value of the k.
    int
    Returns the value of the maxSeqLength.
    long
    Returns the value of the padTokenId.
    boolean
    Returns the value of the suffixPadding.
    void
    setAlpha(float alpha)
    Sets the value of alpha the penalty for repetition.
    void
    setBeam(int beam)
    Sets the value of beam size.
    void
    setK(int k)
    Sets the value for the topk choice.
    void
    setMaxSeqLength(int maxSeqLength)
    Sets the value of max sequence length.
    void
    setPadTokenId(long padTokenId)
    Sets the value of padTokenId.
    void
    setSuffixPadding(boolean suffixPadding)
    Sets the value of suffixPadding or rightPadding.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SearchConfig

      public SearchConfig()
      Constructs a new ContrastiveSearchConfig instance with default values.
  • Method Details

    • getK

      public int getK()
      Returns the value of the k.
      Returns:
      the value of k
    • setK

      public void setK(int k)
      Sets the value for the topk choice.
      Parameters:
      k - the value for topk choice
    • getAlpha

      public float getAlpha()
      Returns the value of the alpha.
      Returns:
      the value of alpha
    • setAlpha

      public void setAlpha(float alpha)
      Sets the value of alpha the penalty for repetition.
      Parameters:
      alpha - the value of the penalty for repetition
    • getBeam

      public int getBeam()
      Returns the value of the beam.
      Returns:
      the value of beam
    • setBeam

      public void setBeam(int beam)
      Sets the value of beam size.
      Parameters:
      beam - the value of beam size
    • getMaxSeqLength

      public int getMaxSeqLength()
      Returns the value of the maxSeqLength.
      Returns:
      the value of maxSeqLength
    • setMaxSeqLength

      public void setMaxSeqLength(int maxSeqLength)
      Sets the value of max sequence length.
      Parameters:
      maxSeqLength - the value max sequence length
    • getPadTokenId

      public long getPadTokenId()
      Returns the value of the padTokenId.
      Returns:
      the value of padTokenId
    • setPadTokenId

      public void setPadTokenId(long padTokenId)
      Sets the value of padTokenId.
      Parameters:
      padTokenId - the token id for padding
    • getEosTokenId

      public long getEosTokenId()
      Returns the value of the eosTokenId.
      Returns:
      the value of eosTokenId
    • isSuffixPadding

      public boolean isSuffixPadding()
      Returns the value of the suffixPadding.
      Returns:
      the value of suffixPadding
    • setSuffixPadding

      public void setSuffixPadding(boolean suffixPadding)
      Sets the value of suffixPadding or rightPadding.
      Parameters:
      suffixPadding - whether the padding is from right