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 Object
The builder for question answering translator.
  • Constructor Details

    • BaseBuilder

      public BaseBuilder()
  • Method Details

    • optBatchifier

      public T optBatchifier(Batchifier batchifier)
      Sets the Batchifier for the Translator.
      Parameters:
      batchifier - the Batchifier to be set
      Returns:
      this builder
    • optTokenizer

      public T optTokenizer(String tokenizer)
      Sets the name of the tokenizer for the Translator.
      Parameters:
      tokenizer - the name of the tokenizer
      Returns:
      this builder
    • optVocab

      public T optVocab(String vocab)
      Sets the name of the vocabulary file for the Translator.
      Parameters:
      vocab - name of the vocabulary file
      Returns:
      this builder
    • optLocale

      public T optLocale(String locale)
      Sets the name of the locale for the Translator.
      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 the Translator.
      Parameters:
      toLowerCase - if convert text to lower case
      Returns:
      this builder
    • optIncludeTokenTypes

      public T optIncludeTokenTypes(boolean includeTokenTypes)
      Sets the if include token types for the Translator.
      Parameters:
      includeTokenTypes - if include token types
      Returns:
      this builder
    • optPadding

      public T optPadding(boolean padding)
      Sets the if pad the tokens for the Translator.
      Parameters:
      padding - if pad the tokens
      Returns:
      this builder
    • optTruncation

      public T optTruncation(boolean truncation)
      Sets the if truncate the tokens for the Translator.
      Parameters:
      truncation - if truncate the tokens
      Returns:
      this builder
    • optMaxLength

      public T optMaxLength(int maxLength)
      Sets the max number of tokens for the Translator.
      Parameters:
      maxLength - the max number of tokens
      Returns:
      this builder
    • optMaxLabels

      public T optMaxLabels(int maxLabels)
      Sets the max number of labels for the Translator.
      Parameters:
      maxLabels - the max number of labels
      Returns:
      this builder
    • configure

      public void configure(Map<String,?> arguments)
      Configures the builder with the model arguments.
      Parameters:
      arguments - the model arguments
    • self

      protected abstract T self()