Package ai.djl.huggingface.translator
Class TextEmbeddingTranslator.Builder
java.lang.Object
ai.djl.huggingface.translator.TextEmbeddingTranslator.Builder
- Enclosing class:
- TextEmbeddingTranslator
The builder for token classification translator.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the translator.voidConfigures the builder with the model arguments.optBatchifier(ai.djl.translate.Batchifier batchifier) Sets theBatchifierfor theTranslator.optIncludeTokenTypes(boolean includeTokenTypes) Sets if include token types for theTranslator.optNormalize(boolean normalize) Sets thenormalizefor theTranslator.optPoolingMode(String poolingMode) Sets the pooling for theTranslator.
-
Method Details
-
optBatchifier
Sets theBatchifierfor theTranslator.- Parameters:
batchifier- true to include token types- Returns:
- this builder
-
optNormalize
Sets thenormalizefor theTranslator.- Parameters:
normalize- true to normalize the embeddings- Returns:
- this builder
-
optPoolingMode
Sets the pooling for theTranslator.- Parameters:
poolingMode- the pooling model, one of mean_pool, max_pool and cls- Returns:
- this builder
-
optIncludeTokenTypes
Sets if include token types for theTranslator.- Parameters:
includeTokenTypes- true to include token types- Returns:
- this builder
-
configure
Configures the builder with the model arguments.- Parameters:
arguments- the model arguments
-
build
Builds the translator.- Returns:
- the new translator
- Throws:
IOException- if I/O error occurs
-