Package ai.djl.modality.nlp.generate
Class SearchConfig
java.lang.Object
ai.djl.modality.nlp.generate.SearchConfig
SearchConfig is a class whose fields are parameters used for autoregressive search / text
generation.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newContrastiveSearchConfiginstance with default values. -
Method Summary
Modifier and TypeMethodDescriptionfloatgetAlpha()Returns the value of the alpha.intgetBeam()Returns the value of the beam.longReturns the value of the eosTokenId.intgetK()Returns the value of the k.intReturns the value of the maxSeqLength.longReturns the value of the padTokenId.booleanReturns the value of the suffixPadding.voidsetAlpha(float alpha) Sets the value of alpha the penalty for repetition.voidsetBeam(int beam) Sets the value of beam size.voidsetK(int k) Sets the value for the topk choice.voidsetMaxSeqLength(int maxSeqLength) Sets the value of max sequence length.voidsetPadTokenId(long padTokenId) Sets the value of padTokenId.voidsetSuffixPadding(boolean suffixPadding) Sets the value of suffixPadding or rightPadding.
-
Constructor Details
-
SearchConfig
public SearchConfig()Constructs a newContrastiveSearchConfiginstance 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
-