Package 

Class OnnxAdapter

  • 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 ModelConfig config
    • 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
      ModelConfig getConfig()
      JsonObject run(JsonObject input) Run one job.
      SampleResult runSample(JsonObject sample) Warm up / self-test using the recipe's sample.
      Unit close()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OnnxAdapter

        OnnxAdapter(ModelConfig config, String kind, OrtEnvironment env, OrtSession session, HuggingFaceTokenizer tokenizer, List<String> labels)