Package ai.djl.huggingface.translator
Class FillMaskTranslator.Builder
- java.lang.Object
-
- ai.djl.huggingface.translator.FillMaskTranslator.Builder
-
- Enclosing class:
- FillMaskTranslator
public static final class FillMaskTranslator.Builder extends java.lang.ObjectThe builder for fill mask translator.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FillMaskTranslatorbuild()Builds the translator.voidconfigure(java.util.Map<java.lang.String,?> arguments)Configures the builder with the model arguments.FillMaskTranslator.BuilderoptBatchifier(ai.djl.translate.Batchifier batchifier)Sets theBatchifierfor theTranslator.FillMaskTranslator.BuilderoptMaskToken(java.lang.String maskedToken)Sets the id of the maskTranslator.FillMaskTranslator.BuilderoptTopK(int topK)Set the topK number of classes to be displayed.
-
-
-
Method Detail
-
optMaskToken
public FillMaskTranslator.Builder optMaskToken(java.lang.String maskedToken)
Sets the id of the maskTranslator.- Parameters:
maskedToken- the id of the mask- Returns:
- this builder
-
optTopK
public FillMaskTranslator.Builder optTopK(int topK)
Set the topK number of classes to be displayed.- Parameters:
topK- the number of top classes to return- Returns:
- this builder
-
optBatchifier
public FillMaskTranslator.Builder optBatchifier(ai.djl.translate.Batchifier batchifier)
Sets theBatchifierfor theTranslator.- Parameters:
batchifier- true to include token types- 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 FillMaskTranslator build() throws java.io.IOException
Builds the translator.- Returns:
- the new translator
- Throws:
java.io.IOException- if I/O error occurs
-
-