OnnxAdapter class
AIModelAdapter implementation backed by the ONNX Runtime.
Basic usage
final bytes = await File('model.onnx').readAsBytes();
final adapter = OnnxAdapter(modelBytes: bytes, modelId: 'my-model');
final report = await SateAI.stress(
model: adapter,
injectors: [MemoryPressureInjector(limitMb: 200)],
);
adapter.dispose();
The adapter accepts raw model bytes instead of a file path so it works uniformly with Flutter asset bundles, network fetches, and local storage without coupling to a specific I/O API.
- Implemented types
Constructors
- OnnxAdapter({required Uint8List modelBytes, required String modelId, OrtSessionFactory? sessionFactory})
- Constructs an OnnxAdapter.
Properties
- currentMemoryMB → double
-
Estimated memory currently consumed by the model in megabytes.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDegraded → bool
-
Whether the model is in a degraded / unreliable state.
no setteroverride
- modelId → String
-
Stable identifier for this model (used in reports).
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Releases all ONNX Runtime resources held by this adapter.
-
isHealthy(
) → Future< bool> -
Returns
truewhen the adapter can safely accept inference calls.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → Future< void> -
Resets the adapter to a healthy, non-degraded state.
override
-
runInference(
AIInput input) → Future< AIOutput> -
Runs a single ONNX inference call.
override
-
simulateMemoryPressure(
int mb) → Future< void> -
Increases the simulated memory footprint by
mbmegabytes.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited