File tree Expand file tree Collapse file tree
src/main/java/com/flockyou/ai Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,14 @@ android {
106106 resources {
107107 excludes + = " /META-INF/{AL2.0,LGPL2.1}"
108108 }
109+ jniLibs {
110+ keepDebugSymbols + = listOf (
111+ " */libllm_inference_engine_jni.so" ,
112+ " */libsqlcipher.so" ,
113+ " */libtensorflowlite_gpu_jni.so" ,
114+ " */libtensorflowlite_jni.so"
115+ )
116+ }
109117 }
110118
111119 // Ensure all build variants are visible in Android Studio
Original file line number Diff line number Diff line change @@ -92,9 +92,17 @@ class MediaPipeLlmClient @Inject constructor(
9292 Log .d(TAG , " Initializing MediaPipe LLM with model: ${modelFile.name} (${modelFile.length() / 1024 / 1024 } MB)" )
9393
9494 // Build LLM inference options
95+ // Must set PreferredBackend to GPU or CPU (not legacy) for models with input masks
9596 val optionsBuilder = LlmInference .LlmInferenceOptions .builder()
9697 .setModelPath(modelFile.absolutePath)
9798 .setMaxTokens(config.maxTokens)
99+ .setPreferredBackend(
100+ if (config.useGpuAcceleration) {
101+ LlmInference .Backend .GPU
102+ } else {
103+ LlmInference .Backend .CPU
104+ }
105+ )
98106
99107 val options = optionsBuilder.build()
100108
You can’t perform that action at this time.
0 commit comments