speech,photos: switch to a reduced ONNX Runtime build (-17 MB each)
- Commit
4388beaeeec688d8fce761615d58f33d6e5ce8d4- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-22 23:24 UTC (3 months ago)
- Parents
534daf1
Diff
gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex c0b60df138..71a15990a3 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -104,6 +104,9 @@ jgit = "6.10.1.202505221210-r" # On-device AI onnxruntimeAndroid = "1.27.0"+# Reduced-operator rebuild of the above, arm64-only. Version tracks upstream plus an -rN+# suffix for the operator-set revision, so a rebuild with different ops gets a new version.+onnxruntimeReduced = "1.27.0-r1" # Crypto, security & credential storage cryptographyCore = "0.6.0"@@ -281,6 +284,11 @@ jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit" } # On-device AI onnxruntime-android = { module = "com.microsoft.onnxruntime:onnxruntime-android", version.ref = "onnxruntimeAndroid" }+# Same source as onnxruntime-android, built with --include_ops_by_config for exactly the+# operators whisper-tiny (speech) and TinyCLIP (photos) need: 10 MB of native code instead of+# 28 MB. Only those two apps may use it — a model with an operator outside the configured set+# fails at session creation, not at inference. openassistant stays on the full build.+onnxruntime-reduced = { module = "io.github.vayun-mathur:onnxruntime-reduced-android", version.ref = "onnxruntimeReduced" } # Crypto, security & credential storage cryptography-core = { module = "dev.whyoleg.cryptography:cryptography-core", version.ref = "cryptographyCore" }
photos/build.gradle.kts
diff --git a/photos/build.gradle.kts b/photos/build.gradle.ktsindex 2fda23a935..eeac8184f0 100644--- a/photos/build.gradle.kts+++ b/photos/build.gradle.kts@@ -70,5 +70,9 @@ dependencies { // Semantic photo search runs on-device again: TinyCLIP int8 ships in assets/clip/ and is // executed by ClipEmbedder, so search no longer needs the OpenAssistant app installed.- implementation(libs.onnxruntime.android)+ //+ // Reduced ORT build (10 MB native, vs 28 MB for the full one). Its operator set is+ // generated from the bundled model_int8.onnx, so swapping in a different CLIP export can+ // fail at session creation — regenerate the AAR rather than falling back to the full build.+ implementation(libs.onnxruntime.reduced) }
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex b09cfa86a8..27a53ac9ce 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -22,8 +22,14 @@ dependencyResolutionManagement { mavenLocal() google() mavenCentral()- // JitPack for Stockfish-Library (games:chess) and ncnn-android- maven("https://jitpack.io")+ // JitPack serves only the two personal forks that live there: Stockfish-Library+ // (games:chess) and ncnn-android. Scoped to com.github.* because JitPack answers+ // unknown coordinates with 401/429 rather than 404, and Gradle treats that as a hard+ // failure — an unscoped JitPack breaks resolution of anything Central hasn't yet+ // propagated (e.g. a freshly published artifact).+ maven("https://jitpack.io") {+ content { includeGroupByRegex("com\\.github\\..*") }+ } // RingRTC is published by Signal, not to Maven Central. Scoped to org.signal so nothing else // resolves through it. maven("https://build-artifacts.signal.org/libraries/maven/") {
speech/build.gradle.kts
diff --git a/speech/build.gradle.kts b/speech/build.gradle.ktsindex 96f4892407..0139b7f9c9 100644--- a/speech/build.gradle.kts+++ b/speech/build.gradle.kts@@ -31,7 +31,11 @@ dependencies { // Speech-to-text is whisper-tiny int8 ONNX (bundled in assets, see WhisperOnnxEngine). // It is not ncnn: onnx2ncnn has no DynamicQuantizeLinear/MatMulInteger/ConvInteger // support, and the AAR's Whisper expects a six-net decomposition HF does not export.- implementation(libs.onnxruntime.android)+ //+ // Reduced ORT build (10 MB native, vs 28 MB for the full one). Its operator set is+ // generated from the two bundled .onnx files, so if they are ever re-exported with+ // different ops the session will fail to create — regenerate the AAR, don't work around it.+ implementation(libs.onnxruntime.reduced) // Runtime model download (mirror-hosted, SHA-256 pinned) — non-English TTS voices only. implementation(project(":library:downloadservice"))