Package ai.djl.huggingface.translator
Class ZeroShotClassificationTranslator.Builder
java.lang.Object
ai.djl.huggingface.translator.ZeroShotClassificationTranslator.Builder
- Enclosing class:
- ZeroShotClassificationTranslator
The builder for zero-shot classification translator.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the translator.voidConfigures the builder with the model arguments.optContradictionId(int contradictionId) Optional: Set custom contradiction ID if different from default (0).optEntailmentId(int entailmentId) Optional: Set custom entailment ID if different from default (2).optInt32(boolean int32) Specifies whether to use int32 as the data type for input token tensors.optTokenTypeId(boolean tokenTypeId) Specifies whether to include token type IDs in the input tensors.
-
Method Details
-
optTokenTypeId
Specifies whether to include token type IDs in the input tensors.- Parameters:
tokenTypeId-trueto include token type IDs,falseto omit them- Returns:
- this builder instance for method chaining
-
optInt32
Specifies whether to use int32 as the data type for input token tensors.- Parameters:
int32-trueto use int32 inputs,falseto use the default type- Returns:
- this builder instance for method chaining
-
optEntailmentId
Optional: Set custom entailment ID if different from default (2). This value usually comes from the model's `config.json` `label2id` mapping.- Parameters:
entailmentId- The index for the 'entailment' label.- Returns:
- this builder
-
optContradictionId
Optional: Set custom contradiction ID if different from default (0). This value usually comes from the model's `config.json` `label2id` mapping.- Parameters:
contradictionId- The index for the 'contradiction' label.- 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
-