Class OrtLoraAdapter

java.lang.Object
ai.onnxruntime.OrtLoraAdapter
All Implemented Interfaces:
AutoCloseable

public final class OrtLoraAdapter extends Object implements AutoCloseable
A container for an adapter which can be supplied to OrtSession.RunOptions.addActiveLoraAdapter(OrtLoraAdapter) to apply the adapter to a specific execution of a model.
  • Method Details

    • create

      public static OrtLoraAdapter create(byte[] loraArray) throws OrtException
      Creates an instance of OrtLoraAdapter from a byte array.
      Parameters:
      loraArray - The LoRA stored in a byte array.
      Returns:
      An OrtLoraAdapter instance.
      Throws:
      OrtException - If the native call failed.
    • create

      public static OrtLoraAdapter create(ByteBuffer loraBuffer) throws OrtException
      Creates an instance of OrtLoraAdapter from a direct ByteBuffer.
      Parameters:
      loraBuffer - The buffer to load.
      Returns:
      An OrtLoraAdapter instance.
      Throws:
      OrtException - If the native call failed.
    • create

      public static OrtLoraAdapter create(String adapterPath) throws OrtException
      Creates an instance of OrtLoraAdapter.
      Parameters:
      adapterPath - path to the adapter file that is going to be memory mapped.
      Returns:
      An OrtLoraAdapter instance.
      Throws:
      OrtException - If the native call failed.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable