-
- All Implemented Interfaces:
-
ai.zerogpu.android.sdk.adapter.InferenceAdapter,java.lang.AutoCloseable
public final class OnnxAdapter implements InferenceAdapter
One ONNX adapter: tokenize with the HuggingFace tokenizer (standard
tokenizer.json), run the model with ONNX Runtime, then decode the output tensors into opaque JSON with a small, bounded per-kind decoder. Decoding is plain Kotlin over copied output floats (no tensor-math engine), which is why this avoids the DJL "Not implemented" class of failures. Same artifacts as the browser SDK / cloud.
-
-
Field Summary
Fields Modifier and Type Field Description private final ModelConfigconfig
-
Constructor Summary
Constructors Constructor Description OnnxAdapter(ModelConfig config, String kind, OrtEnvironment env, OrtSession session, HuggingFaceTokenizer tokenizer, List<String> labels)
-
Method Summary
Modifier and Type Method Description ModelConfiggetConfig()JsonObjectrun(JsonObject input)Run one job. SampleResultrunSample(JsonObject sample)Warm up / self-test using the recipe's sample. Unitclose()-
-
Constructor Detail
-
OnnxAdapter
OnnxAdapter(ModelConfig config, String kind, OrtEnvironment env, OrtSession session, HuggingFaceTokenizer tokenizer, List<String> labels)
-
-
Method Detail
-
getConfig
ModelConfig getConfig()
-
run
JsonObject run(JsonObject input)
Run one job. Input and output are opaque JSON the SDK core never inspects.
-
runSample
SampleResult runSample(JsonObject sample)
Warm up / self-test using the recipe's sample.
-
-
-
-