Skip to content

Commit 6a7c821

Browse files
Clean up Genie: download models from HuggingFace, remove local staging
- ModelList.kt: Replace empty URLs with HuggingFace download URLs for Llama 3.2 1B and Qwen 2.5 7B Genie NPU models hosted at runanywhere/genie-npu-models - ModelList.kt: Remove genieLocalPaths map, CppBridgeModelRegistry local path logic, and Llama 3.2 3B entry (no compiled binaries) - build-android.sh: Remove Genie .so staging block (belongs in private repo, not monorepo) - build-kotlin.sh: Remove GENIE_JNILIBS_DIR and Genie .so copy logic Models uploaded to: https://huggingface.co/runanywhere/genie-npu-models Made-with: Cursor
1 parent 6d11140 commit 6a7c821

3 files changed

Lines changed: 4 additions & 77 deletions

File tree

examples/android/RunAnywhereAI/app/src/main/java/com/runanywhere/runanywhereai/data/ModelList.kt

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import com.runanywhere.sdk.public.extensions.LoraAdapterCatalogEntry
1111
import com.runanywhere.sdk.public.extensions.ModelCompanionFile
1212
import com.runanywhere.sdk.public.extensions.Models.ModelCategory
1313
import com.runanywhere.sdk.public.extensions.Models.ModelFileDescriptor
14-
import com.runanywhere.sdk.foundation.bridge.extensions.CppBridgeModelRegistry
1514
import com.runanywhere.sdk.public.extensions.registerLoraAdapter
1615
import com.runanywhere.sdk.public.extensions.registerModel
1716
import com.runanywhere.sdk.public.extensions.registerMultiFileModel
@@ -128,30 +127,19 @@ object ModelList {
128127
)
129128

130129
// Genie NPU Models (Qualcomm Snapdragon 8 Gen 2+)
131-
// Export models via: python -m qai_hub_models.models.<model>.export --chipset <chipset>
132-
// Or use pre-built: huggingface-cli download Volko76/Llama-3.2-3B-Genie-Compatible-QNN-Binaries
133-
// Push to device: adb push <model_dir> /sdcard/Android/data/com.runanywhere.runanywhereai/files/models/<model-id>/
130+
// Pre-compiled QNN context binaries for Qualcomm Genie SDK.
131+
// Compiled via: python -m qai_hub_models.models.<model>.export --chipset qualcomm-snapdragon-8-elite
134132
private val genieModels = listOf(
135133
AppModel(id = "qwen2_5-7b-instruct-genie", name = "Qwen 2.5 7B (NPU)",
136-
url = "",
134+
url = "https://huggingface.co/runanywhere/genie-npu-models/resolve/main/qwen2.5-7b-instruct-genie-w8a16.tar.gz",
137135
framework = InferenceFramework.GENIE, category = ModelCategory.LANGUAGE,
138136
memoryRequirement = 5_000_000_000),
139-
AppModel(id = "llama-3.2-3b-instruct-genie", name = "Llama 3.2 3B (NPU)",
140-
url = "",
141-
framework = InferenceFramework.GENIE, category = ModelCategory.LANGUAGE,
142-
memoryRequirement = 3_000_000_000),
143137
AppModel(id = "llama-3.2-1b-instruct-genie", name = "Llama 3.2 1B (NPU)",
144-
url = "",
138+
url = "https://huggingface.co/runanywhere/genie-npu-models/resolve/main/llama-3.2-1b-instruct-genie-w4.tar.gz",
145139
framework = InferenceFramework.GENIE, category = ModelCategory.LANGUAGE,
146140
memoryRequirement = 1_500_000_000),
147141
)
148142

149-
// Pre-loaded Genie model paths on device (for testing NPU models pushed via adb)
150-
private val genieLocalPaths = mapOf(
151-
"qwen2_5-7b-instruct-genie" to "/data/local/tmp/genie-model",
152-
"llama-3.2-1b-instruct-genie" to "/data/local/tmp/genie-llama-1b",
153-
)
154-
155143
// VLM
156144
private val vlmModels = listOf(
157145
AppModel(id = "smolvlm-500m-instruct-q8_0", name = "SmolVLM 500M Instruct",
@@ -223,19 +211,6 @@ object ModelList {
223211
Timber.i("$label models registered (${models.size})")
224212
}
225213

226-
// Set local paths for pre-loaded Genie models (pushed to device via adb)
227-
for ((modelId, localPath) in genieLocalPaths) {
228-
try {
229-
if (CppBridgeModelRegistry.updateDownloadStatus(modelId, localPath)) {
230-
Timber.i("Set Genie model local path: $modelId -> $localPath")
231-
} else {
232-
Timber.w("Failed to set local path for Genie model: $modelId")
233-
}
234-
} catch (e: Exception) {
235-
Timber.e(e, "Error setting Genie model path: $modelId")
236-
}
237-
}
238-
239214
for (adapter in loraAdapters) {
240215
try {
241216
RunAnywhere.registerLoraAdapter(adapter)

sdk/runanywhere-commons/scripts/build-android.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -619,27 +619,6 @@ for ABI in "${ABI_ARRAY[@]}"; do
619619
print_warning "librac_backend_rag_jni.so not found - JNI bridge not built by CMake"
620620
fi
621621

622-
# Genie backend (Qualcomm NPU) — pre-built artifacts only, not cmake-built.
623-
# Genie is a closed-source backend. Pre-built .so files are staged from either:
624-
# - Local: GENIE_LOCAL_PATH env var, or auto-detected at ../../runanywhere-genie/dist/android/
625-
# - Remote: downloaded from GENIE_RELEASE_URL (a public release ZIP)
626-
# This section only runs if pre-built artifacts are found.
627-
GENIE_DIST_SRC=""
628-
if [ -n "${GENIE_LOCAL_PATH:-}" ] && [ -d "${GENIE_LOCAL_PATH}/${ABI}" ]; then
629-
GENIE_DIST_SRC="${GENIE_LOCAL_PATH}/${ABI}"
630-
elif [ -d "${ROOT_DIR}/../../runanywhere-genie/dist/android/${ABI}" ]; then
631-
GENIE_DIST_SRC="${ROOT_DIR}/../../runanywhere-genie/dist/android/${ABI}"
632-
fi
633-
634-
if [ -n "${GENIE_DIST_SRC}" ]; then
635-
mkdir -p "${DIST_DIR}/genie/${ABI}"
636-
for so_file in "${GENIE_DIST_SRC}"/*.so; do
637-
[ -f "$so_file" ] || continue
638-
cp "$so_file" "${DIST_DIR}/genie/${ABI}/"
639-
echo " Staged: $(basename "$so_file") -> genie/${ABI}/"
640-
done
641-
fi
642-
643622
# TFLite backend
644623
if [ "$BUILD_TFLITE" = "ON" ]; then
645624
mkdir -p "${DIST_DIR}/tflite/${ABI}"

sdk/runanywhere-kotlin/scripts/build-kotlin.sh

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ MAIN_JNILIBS_DIR="${KOTLIN_SDK_DIR}/src/androidMain/jniLibs"
6767
LLAMACPP_JNILIBS_DIR="${KOTLIN_SDK_DIR}/modules/runanywhere-core-llamacpp/src/androidMain/jniLibs"
6868
ONNX_JNILIBS_DIR="${KOTLIN_SDK_DIR}/modules/runanywhere-core-onnx/src/androidMain/jniLibs"
6969
RAG_JNILIBS_DIR="${KOTLIN_SDK_DIR}/modules/runanywhere-core-rag/src/androidMain/jniLibs"
70-
GENIE_JNILIBS_DIR="${KOTLIN_SDK_DIR}/modules/runanywhere-core-genie/src/androidMain/jniLibs"
7170

7271
# Defaults
7372
MODE="local"
@@ -320,7 +319,6 @@ copy_jni_libs() {
320319
mkdir -p "${LLAMACPP_JNILIBS_DIR}/${ABI}"
321320
mkdir -p "${ONNX_JNILIBS_DIR}/${ABI}"
322321
mkdir -p "${RAG_JNILIBS_DIR}/${ABI}"
323-
mkdir -p "${GENIE_JNILIBS_DIR}/${ABI}"
324322

325323
# =======================================================================
326324
# Main SDK (Commons): Core JNI + libc++_shared.so + librac_commons.so
@@ -443,31 +441,6 @@ copy_jni_libs() {
443441
log_warn "RAG: librac_backend_rag_jni.so NOT FOUND - JNI bridge missing!"
444442
fi
445443

446-
# =======================================================================
447-
# Genie Module: Backend + JNI bridge (optional, Qualcomm NPU only)
448-
# Pre-built artifacts sourced from:
449-
# 1. Commons dist (if build-android.sh staged them)
450-
# 2. GENIE_LOCAL_PATH env var
451-
# 3. Sibling folder: ../../runanywhere-genie/dist/android/
452-
# =======================================================================
453-
GENIE_SRC=""
454-
if [ -d "${COMMONS_DIST}/genie/${ABI}" ] && [ "$(ls -A "${COMMONS_DIST}/genie/${ABI}/" 2>/dev/null)" ]; then
455-
GENIE_SRC="${COMMONS_DIST}/genie/${ABI}"
456-
elif [ -n "${GENIE_LOCAL_PATH:-}" ] && [ -d "${GENIE_LOCAL_PATH}/${ABI}" ]; then
457-
GENIE_SRC="${GENIE_LOCAL_PATH}/${ABI}"
458-
elif [ -d "${KOTLIN_SDK_DIR}/../../runanywhere-genie/dist/android/${ABI}" ]; then
459-
GENIE_SRC="${KOTLIN_SDK_DIR}/../../runanywhere-genie/dist/android/${ABI}"
460-
fi
461-
462-
if [ -n "${GENIE_SRC}" ]; then
463-
mkdir -p "${GENIE_JNILIBS_DIR}/${ABI}"
464-
for so_file in "${GENIE_SRC}"/*.so; do
465-
[ -f "$so_file" ] || continue
466-
cp "$so_file" "${GENIE_JNILIBS_DIR}/${ABI}/"
467-
log_info "Genie: $(basename "$so_file")"
468-
done
469-
fi
470-
471444
done
472445

473446
log_info "JNI libraries installed"

0 commit comments

Comments
 (0)