Package ai.djl.huggingface.translator
Class TextEmbeddingTranslator.Builder
- java.lang.Object
-
- ai.djl.huggingface.translator.TextEmbeddingTranslator.Builder
-
- Enclosing class:
- TextEmbeddingTranslator
public static final class TextEmbeddingTranslator.Builder extends java.lang.ObjectThe builder for token classification translator.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextEmbeddingTranslatorbuild()Builds the translator.voidconfigure(java.util.Map<java.lang.String,?> arguments)Configures the builder with the model arguments.TextEmbeddingTranslator.BuilderoptBatchifier(ai.djl.translate.Batchifier batchifier)Sets theBatchifierfor theTranslator.TextEmbeddingTranslator.BuilderoptNormalize(boolean normalize)Sets thenormalizefor theTranslator.TextEmbeddingTranslator.BuilderoptPoolingMode(java.lang.String poolingMode)Sets the pooling for theTranslator.
-
-
-
Method Detail
-
optBatchifier
public TextEmbeddingTranslator.Builder optBatchifier(ai.djl.translate.Batchifier batchifier)
Sets theBatchifierfor theTranslator.- Parameters:
batchifier- true to include token types- Returns:
- this builder
-
optNormalize
public TextEmbeddingTranslator.Builder optNormalize(boolean normalize)
Sets thenormalizefor theTranslator.- Parameters:
normalize- true to normalize the embeddings- Returns:
- this builder
-
optPoolingMode
public TextEmbeddingTranslator.Builder optPoolingMode(java.lang.String poolingMode)
Sets the pooling for theTranslator.- 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
-
-