Package ai.djl.modality.nlp.translator
Class SimpleText2TextTranslator
java.lang.Object
ai.djl.modality.nlp.translator.SimpleText2TextTranslator
- All Implemented Interfaces:
PostProcessor<String>
,PreProcessor<String>
,Translator<String,
String>
A
Translator
that performs pre-process and post-processing for a sequence-to-sequence
text model.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns theBatchifier
.processInput
(TranslatorContext ctx, String input) Processes the input and converts it to NDList.processOutput
(TranslatorContext ctx, NDList list) Processes the output NDList to the corresponding output object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions, prepare
-
Constructor Details
-
SimpleText2TextTranslator
public SimpleText2TextTranslator()
-
-
Method Details
-
processOutput
Processes the output NDList to the corresponding output object.- Specified by:
processOutput
in interfacePostProcessor<String>
- Parameters:
ctx
- the toolkit used for post-processinglist
- the output NDList after inference, usually immutable in engines like PyTorch. @see Issue 1774- Returns:
- the output object of expected type
-
processInput
Processes the input and converts it to NDList.- Specified by:
processInput
in interfacePreProcessor<String>
- Parameters:
ctx
- the toolkit for creating the input NDArrayinput
- the input object- Returns:
- the
NDList
after pre-processing
-
getBatchifier
Returns theBatchifier
.- Specified by:
getBatchifier
in interfaceTranslator<String,
String> - Returns:
- the
Batchifier
-