Class TextEmbeddingTranslator.Builder

java.lang.Object
ai.djl.huggingface.translator.TextEmbeddingTranslator.Builder
Enclosing class:
TextEmbeddingTranslator

public static final class TextEmbeddingTranslator.Builder extends Object
The builder for token classification translator.
  • Method Details

    • optBatchifier

      public TextEmbeddingTranslator.Builder optBatchifier(ai.djl.translate.Batchifier batchifier)
      Sets the Batchifier for the Translator.
      Parameters:
      batchifier - true to include token types
      Returns:
      this builder
    • optNormalize

      public TextEmbeddingTranslator.Builder optNormalize(boolean normalize)
      Sets the normalize for the Translator.
      Parameters:
      normalize - true to normalize the embeddings
      Returns:
      this builder
    • optPoolingMode

      public TextEmbeddingTranslator.Builder optPoolingMode(String poolingMode)
      Sets the pooling for the Translator.
      Parameters:
      poolingMode - the pooling model, one of mean_pool, max_pool and cls
      Returns:
      this builder
    • optIncludeTokenTypes

      public TextEmbeddingTranslator.Builder optIncludeTokenTypes(boolean includeTokenTypes)
      Sets if include token types for the Translator.
      Parameters:
      includeTokenTypes - true to include token types
      Returns:
      this builder
    • optDense

      public TextEmbeddingTranslator.Builder optDense(String dense)
      Sets the dense layer model file for the Translator.
      Parameters:
      dense - path to dense layer model file
      Returns:
      this builder
    • optDenseActivation

      public TextEmbeddingTranslator.Builder optDenseActivation(String denseActivation)
      Sets the dense activation function for the Translator.
      Parameters:
      denseActivation - path to dense layer
      Returns:
      this builder
    • optLayerNorm

      public TextEmbeddingTranslator.Builder optLayerNorm(String layerNorm)
      Sets the LayerNorm model for the Translator.
      Parameters:
      layerNorm - path to LayerNorm model
      Returns:
      this builder
    • configure

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

      public TextEmbeddingTranslator build() throws IOException
      Builds the translator.
      Returns:
      the new translator
      Throws:
      IOException - if I/O error occurs