Skip to content

recipes: sherpa-onnx 2.0.1 + flet-libonnxruntime 1.28.2 - #139

Merged
ndonkoHenri merged 1 commit into
flet-dev:mainfrom
ndonkoHenri:machine/sherpa-onnx
Nov 17, 2026
Merged

ndonkoHenri merged 1 commit into
flet-dev:mainfrom
ndonkoHenri:machine/sherpa-onnx

Conversation

@ndonkoHenri

@ndonkoHenri ndonkoHenri commented Nov 17, 2026 •

Copy link
Copy Markdown

Adds sherpa-onnx 2.0.1 for Android and iOS: offline speech-to-text, text-to-speech, voice activity detection and keyword spotting on ONNX Runtime. Requested in flet-dev/flet#7096.

It links a prebuilt ONNX Runtime from a new flet-libonnxruntime recipe, so the build does not compile ONNX Runtime itself.

Changes

  • flet-libonnxruntime 1.28.2 (new, build.sh): repackages csukuangfj/onnxruntime-libs, the prebuilt artifacts sherpa-onnx's own mobile builds use, at the version sherpa-onnx 2.0.1 builds against. Android stages the shared libonnxruntime.so; iOS stages the static archive, thinned per slice. The zips have no wrapping folder, so source.strip: 0. They carry no notices either, so licenses/ holds onnxruntime's LICENSE and ThirdPartyNotices.txt (License-Expression: MIT).
  • sherpa-onnx 2.0.1: setup.py drives CMake, pointed at the staged ONNX Runtime through SHERPA_ONNXRUNTIME_{INCLUDE,LIB}_DIR (host_build, so no runtime requirement). SHERPA_ONNX_SPLIT_PYTHON_PACKAGE stays unset, giving one self-contained wheel with no dependency on PyPI's sherpa-onnx-core, which has no iOS wheels. Three patches:
    • android-no-jni.patch: stop CMake force-enabling the 4 MB JNI library, which a Flet app cannot use.
    • android-preload-ort.patch: load the bundled libonnxruntime.so before the extension (no RUNPATH on Android), by path or by soname.
    • onnxruntime-license.patch: ship ONNX Runtime's MIT licence in the wheel.
  • Tests: extension load, the Python API, native config and buffer objects, and real Silero VAD inference (the model, 0.6 MB, is downloaded at test time).
  • Docs: recipes/sherpa-onnx/README.md and a transcribe example.

Validation

  • Fork CI with prebuild_recipes=flet-libonnxruntime (run): on-device tests 5/5, none skipped, on Android 3.12/3.13/3.14 and iOS 3.13/3.14. The iOS 3.12 job never got a macOS runner; I built those three slices locally instead.
  • The transcribe example, built from these wheels, downloads a 29 MB English model and transcribes its sample correctly on an Android arm64 emulator and an iPhone simulator.
  • Android wheels are 9–12 MB; iOS is one 27 MB extension with ONNX Runtime linked in.

CI note: sherpa-onnx needs flet-libonnxruntime at build time, and it is not published yet, so this PR's own CI may fail the sherpa-onnx legs on the Pythons where the build.sh recipe is skipped. A dispatch with prebuild_recipes=flet-libonnxruntime covers it, as in the fork run above.

Consumer notes

Flet apps can run speech recognition and synthesis on the device, offline once a model is downloaded, with sherpa-onnx==2.0.1 (no numpy needed). See the recipe README for models, storage and app size, and the transcribe example.

sherpa-onnx (speech-to-text, text-to-speech, VAD, keyword spotting) for
Android and iOS, linking a prebuilt ONNX Runtime from the new
flet-libonnxruntime recipe. One self-contained wheel per Python, with a
README and a transcribe example.
@ndonkoHenri
ndonkoHenri merged commit 771eb58 into flet-dev:main Nov 17, 2026
8 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant