Class ZeroShotClassificationTranslator

java.lang.Object
ai.djl.huggingface.translator.ZeroShotClassificationTranslator
All Implemented Interfaces:
ai.djl.translate.NoBatchifyTranslator<ai.djl.modality.nlp.translator.ZeroShotClassificationInput,ai.djl.modality.nlp.translator.ZeroShotClassificationOutput>, ai.djl.translate.PostProcessor<ai.djl.modality.nlp.translator.ZeroShotClassificationOutput>, ai.djl.translate.PreProcessor<ai.djl.modality.nlp.translator.ZeroShotClassificationInput>, ai.djl.translate.Translator<ai.djl.modality.nlp.translator.ZeroShotClassificationInput,ai.djl.modality.nlp.translator.ZeroShotClassificationOutput>

public class ZeroShotClassificationTranslator extends Object implements ai.djl.translate.NoBatchifyTranslator<ai.djl.modality.nlp.translator.ZeroShotClassificationInput,ai.djl.modality.nlp.translator.ZeroShotClassificationOutput>
The translator for Huggingface zero-shot-classification model.
  • Method Details

    • prepare

      public void prepare(ai.djl.translate.TranslatorContext ctx) throws IOException, ai.djl.ModelException
      Specified by:
      prepare in interface ai.djl.translate.Translator<ai.djl.modality.nlp.translator.ZeroShotClassificationInput,ai.djl.modality.nlp.translator.ZeroShotClassificationOutput>
      Throws:
      IOException
      ai.djl.ModelException
    • processInput

      public ai.djl.ndarray.NDList processInput(ai.djl.translate.TranslatorContext ctx, ai.djl.modality.nlp.translator.ZeroShotClassificationInput input)
      Specified by:
      processInput in interface ai.djl.translate.PreProcessor<ai.djl.modality.nlp.translator.ZeroShotClassificationInput>
    • processOutput

      public ai.djl.modality.nlp.translator.ZeroShotClassificationOutput processOutput(ai.djl.translate.TranslatorContext ctx, ai.djl.ndarray.NDList list) throws ai.djl.translate.TranslateException
      Specified by:
      processOutput in interface ai.djl.translate.PostProcessor<ai.djl.modality.nlp.translator.ZeroShotClassificationOutput>
      Throws:
      ai.djl.translate.TranslateException
    • builder

      Creates a builder to build a ZeroShotClassificationTranslator.
      Parameters:
      tokenizer - the tokenizer
      Returns:
      a new builder
    • builder

      public static ZeroShotClassificationTranslator.Builder builder(HuggingFaceTokenizer tokenizer, Map<String,?> arguments)
      Creates a builder to build a ZeroShotClassificationTranslator.
      Parameters:
      tokenizer - the tokenizer
      arguments - the models' arguments
      Returns:
      a new builder