modelport_executorch 0.1.0
modelport_executorch: ^0.1.0 copied to clipboard
PyTorch ExecuTorch adapter for ModelPort. Runs executorch (.pte) variants of modelport.json bundles, delegated to XNNPACK.
modelport_executorch #
PyTorch ExecuTorch engine for ModelPort. Runs the executorch variants (.pte programs) of modelport.json bundles through executorch_flutter.
await ModelPortFlutter.init(adapters: [ExecuTorchAdapter()]);
final detector = await ObjectDetector.load(
'https://github.com/ayanparvaiz/modelport/releases/download/zoo-v1/yolos-tiny.json',
);
- The fastest engine on the test phone. MobileNetV3 Small ran in 17 ms on an OPPO CPH1937, against 77 ms with ONNX Runtime, and passed its golden check.
- Small. About 7.6 MB in an arm64 APK.
- Inputs go in manifest order. ExecuTorch takes inputs by position, so the adapter orders them from the manifest and checks every output's type.
- Exports that just work.
modelport export --target executorchlowers to XNNPACK and makes example inputs contiguous; achannels_lastexample input otherwise produces a program that rejects ordinary inputs.
Requirements #
- Flutter 3.38 or newer.
cmakeon the build machine, for examplebrew install cmake.executorch_flutterdownloads prebuilt ExecuTorch but builds a small wrapper..ptefiles exported with the ExecuTorch versionexecutorch_flutterships (1.5 at the time of writing).
Troubleshooting #
macOS build fails with deployment target 11.0. executorch_dart passes 11.0 to CMake, which Xcode 27 rejects, and it can stick in the build cache. Set your app's macOS target to 14.0, delete .dart_tool/hooks_runner/shared/executorch_dart/build/, and build again.
Example #
The example app classifies a photo with MobileNetV3, detects objects with YOLOS Tiny, and runs both golden checks.
License #
Apache-2.0