Class TextEmbeddingTranslator.Builder

  • Enclosing class:
    TextEmbeddingTranslator

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

      • 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​(java.lang.String poolingMode)
        Sets the pooling for the Translator.
        Parameters:
        poolingMode - the pooling model, one of mean_pool, max_pool and cls
        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
      • build

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