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.Sets the dense layer model file for theTranslator.optDenseActivation(String denseActivation) Sets the dense activation function for theTranslator.optIncludeTokenTypes(boolean includeTokenTypes) Sets if include token types for theTranslator.optLayerNorm(String layerNorm) Sets the LayerNorm model 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
-
optDense
Sets the dense layer model file for theTranslator.- Parameters:
dense- path to dense layer model file- Returns:
- this builder
-
optDenseActivation
Sets the dense activation function for theTranslator.- Parameters:
denseActivation- path to dense layer- Returns:
- this builder
-
optLayerNorm
Sets the LayerNorm model for theTranslator.- Parameters:
layerNorm- path to LayerNorm model- 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
-