Class ZeroShotClassificationTranslator.Builder

java.lang.Object
ai.djl.huggingface.translator.ZeroShotClassificationTranslator.Builder
Enclosing class:
ZeroShotClassificationTranslator

public static final class ZeroShotClassificationTranslator.Builder extends Object
The builder for zero-shot classification translator.
  • Method Details

    • optTokenTypeId

      public ZeroShotClassificationTranslator.Builder optTokenTypeId(boolean tokenTypeId)
      Specifies whether to include token type IDs in the input tensors.
      Parameters:
      tokenTypeId - true to include token type IDs, false to omit them
      Returns:
      this builder instance for method chaining
    • optInt32

      public ZeroShotClassificationTranslator.Builder optInt32(boolean int32)
      Specifies whether to use int32 as the data type for input token tensors.
      Parameters:
      int32 - true to use int32 inputs, false to use the default type
      Returns:
      this builder instance for method chaining
    • optEntailmentId

      public ZeroShotClassificationTranslator.Builder optEntailmentId(int entailmentId)
      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

      public ZeroShotClassificationTranslator.Builder optContradictionId(int contradictionId)
      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

      public void configure(Map<String,?> arguments)
      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