Class CustomTranslator
java.lang.Object
org.apache.ignite.example.ml.custom.CustomTranslator
- All Implemented Interfaces:
ai.djl.translate.NoBatchifyTranslator<CustomInput,,CustomOutput> ai.djl.translate.PostProcessor<CustomOutput>,ai.djl.translate.PreProcessor<CustomInput>,ai.djl.translate.Translator<CustomInput,CustomOutput>
public class CustomTranslator
extends Object
implements ai.djl.translate.NoBatchifyTranslator<CustomInput,CustomOutput>
Custom translator for processing model input and output for custom ML inference.
This implementation avoids DJL operations not supported by RsNDArray (Rust backend):
- No negative dimension indexing (e.g., softmax(-1))
- No argSort (not implemented in Rust backend)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic CustomTranslator.Builderbuilder(ai.djl.huggingface.tokenizers.HuggingFaceTokenizer tokenizer) static CustomTranslator.Buildervoidprepare(ai.djl.translate.TranslatorContext ctx) ai.djl.ndarray.NDListprocessInput(ai.djl.translate.TranslatorContext ctx, CustomInput input) processOutput(ai.djl.translate.TranslatorContext ctx, ai.djl.ndarray.NDList list) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.djl.translate.NoBatchifyTranslator
getBatchifierMethods inherited from interface ai.djl.translate.Translator
batchProcessInput, batchProcessOutput, getExpansions
-
Method Details
-
prepare
public void prepare(ai.djl.translate.TranslatorContext ctx) throws IOException, ai.djl.ModelException - Specified by:
preparein interfaceai.djl.translate.Translator<CustomInput,CustomOutput> - Throws:
IOExceptionai.djl.ModelException
-
processInput
public ai.djl.ndarray.NDList processInput(ai.djl.translate.TranslatorContext ctx, CustomInput input) - Specified by:
processInputin interfaceai.djl.translate.PreProcessor<CustomInput>
-
processOutput
public CustomOutput processOutput(ai.djl.translate.TranslatorContext ctx, ai.djl.ndarray.NDList list) throws ai.djl.translate.TranslateException - Specified by:
processOutputin interfaceai.djl.translate.PostProcessor<CustomOutput>- Throws:
ai.djl.translate.TranslateException
-
builder
public static CustomTranslator.Builder builder(ai.djl.huggingface.tokenizers.HuggingFaceTokenizer tokenizer) -
builder
public static CustomTranslator.Builder builder(ai.djl.huggingface.tokenizers.HuggingFaceTokenizer tokenizer, Map<String, ?> arguments)
-