Package ai.djl.modality.nlp.translator
Class QATranslator.BaseBuilder<T extends QATranslator.BaseBuilder>
- java.lang.Object
-
- ai.djl.modality.nlp.translator.QATranslator.BaseBuilder<T>
-
- Enclosing class:
- QATranslator
public abstract static class QATranslator.BaseBuilder<T extends QATranslator.BaseBuilder> extends java.lang.Object
The builder for question answering translator.
-
-
Constructor Summary
Constructors Constructor Description BaseBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(java.util.Map<java.lang.String,?> arguments)
Configures the builder with the model arguments.T
optBatchifier(Batchifier batchifier)
Sets theBatchifier
for theTranslator
.T
optIncludeTokenTypes(boolean includeTokenTypes)
Sets the if include token types for theTranslator
.T
optLocale(java.lang.String locale)
Sets the name of the locale for theTranslator
.T
optMaxLabels(int maxLabels)
Sets the max number of labels for theTranslator
.T
optMaxLength(int maxLength)
Sets the max number of tokens for theTranslator
.T
optPadding(boolean padding)
Sets the if pad the tokens for theTranslator
.T
optTokenizer(java.lang.String tokenizer)
Sets the name of the tokenizer for theTranslator
.T
optToLowerCase(boolean toLowerCase)
Sets the if convert text to lower case for theTranslator
.T
optTruncation(boolean truncation)
Sets the if truncate the tokens for theTranslator
.T
optVocab(java.lang.String vocab)
Sets the name of the vocabulary file for theTranslator
.protected abstract T
self()
-
-
-
Method Detail
-
optBatchifier
public T optBatchifier(Batchifier batchifier)
Sets theBatchifier
for theTranslator
.- Parameters:
batchifier
- theBatchifier
to be set- Returns:
- this builder
-
optTokenizer
public T optTokenizer(java.lang.String tokenizer)
Sets the name of the tokenizer for theTranslator
.- Parameters:
tokenizer
- the name of the tokenizer- Returns:
- this builder
-
optVocab
public T optVocab(java.lang.String vocab)
Sets the name of the vocabulary file for theTranslator
.- Parameters:
vocab
- name of the vocabulary file- Returns:
- this builder
-
optLocale
public T optLocale(java.lang.String locale)
Sets the name of the locale for theTranslator
.- Parameters:
locale
- the name of the locale- Returns:
- this builder
-
optToLowerCase
public T optToLowerCase(boolean toLowerCase)
Sets the if convert text to lower case for theTranslator
.- Parameters:
toLowerCase
- if convert text to lower case- Returns:
- this builder
-
optIncludeTokenTypes
public T optIncludeTokenTypes(boolean includeTokenTypes)
Sets the if include token types for theTranslator
.- Parameters:
includeTokenTypes
- if include token types- Returns:
- this builder
-
optPadding
public T optPadding(boolean padding)
Sets the if pad the tokens for theTranslator
.- Parameters:
padding
- if pad the tokens- Returns:
- this builder
-
optTruncation
public T optTruncation(boolean truncation)
Sets the if truncate the tokens for theTranslator
.- Parameters:
truncation
- if truncate the tokens- Returns:
- this builder
-
optMaxLength
public T optMaxLength(int maxLength)
Sets the max number of tokens for theTranslator
.- Parameters:
maxLength
- the max number of tokens- Returns:
- this builder
-
optMaxLabels
public T optMaxLabels(int maxLabels)
Sets the max number of labels for theTranslator
.- Parameters:
maxLabels
- the max number of labels- Returns:
- this builder
-
configure
public void configure(java.util.Map<java.lang.String,?> arguments)
Configures the builder with the model arguments.- Parameters:
arguments
- the model arguments
-
self
protected abstract T self()
-
-