Package ai.djl.modality.nlp.generate
Class SearchConfig
- java.lang.Object
-
- ai.djl.modality.nlp.generate.SearchConfig
-
public class SearchConfig extends java.lang.Object
SearchConfig
is a class whose fields are parameters used for autoregressive search / text generation.
-
-
Constructor Summary
Constructors Constructor Description SearchConfig()
Constructs a newContrastiveSearchConfig
instance with default values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getAlpha()
Returns the value of the alpha.int
getBeam()
Returns the value of the beam.long
getEosTokenId()
Returns the value of the eosTokenId.int
getK()
Returns the value of the k.int
getMaxSeqLength()
Returns the value of the maxSeqLength.long
getPadTokenId()
Returns the value of the padTokenId.boolean
isSuffixPadding()
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.
-
-
-
Method Detail
-
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
-
-