From 4b3f6ef8d7f1d0d94d18c363dd622eb41dced352 Mon Sep 17 00:00:00 2001 From: Han Yin Date: Thu, 26 Jun 2025 13:21:17 -0700 Subject: [PATCH] misc: rename LlamaAndroid related class to InferenceEngine prefixes --- .../app/src/main/AndroidManifest.xml | 4 ++-- .../java/com/example/llama/di/AppModule.kt | 11 +++++----- .../app/src/main/res/values/strings.xml | 2 +- .../app/src/main/res/values/themes.xml | 2 +- .../llama/src/main/cpp/cpu_detector.cpp | 4 ++-- .../llama/src/main/cpp/llama-android.cpp | 22 +++++++++---------- ...LLamaAndroid.kt => InferenceEngineImpl.kt} | 14 +++++++----- ...raryLoader.kt => InferenceEngineLoader.kt} | 20 ++++++++--------- 8 files changed, 41 insertions(+), 38 deletions(-) rename examples/llama.android/llama/src/main/java/android/llama/cpp/{LLamaAndroid.kt => InferenceEngineImpl.kt} (95%) rename examples/llama.android/llama/src/main/java/android/llama/cpp/{LLamaLibraryLoader.kt => InferenceEngineLoader.kt} (88%) diff --git a/examples/llama.android/app/src/main/AndroidManifest.xml b/examples/llama.android/app/src/main/AndroidManifest.xml index e85d4899b2..616cf384e5 100644 --- a/examples/llama.android/app/src/main/AndroidManifest.xml +++ b/examples/llama.android/app/src/main/AndroidManifest.xml @@ -13,14 +13,14 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.LlamaAndroid" + android:theme="@style/Theme.KleidiLlama" > + android:theme="@style/Theme.KleidiLlama"> diff --git a/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt b/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt index 5914ec7a00..24f6549afb 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/di/AppModule.kt @@ -2,7 +2,7 @@ package com.example.llama.di import android.content.Context import android.llama.cpp.InferenceEngine -import android.llama.cpp.LLamaLibraryLoader +import android.llama.cpp.InferenceEngineLoader import com.example.llama.data.local.AppDatabase import com.example.llama.data.remote.HuggingFaceApiService import com.example.llama.data.remote.HuggingFaceRemoteDataSource @@ -58,14 +58,15 @@ internal abstract class AppModule { ): HuggingFaceRemoteDataSource companion object { - private const val USE_REAL_ENGINE = true + private const val USE_STUB_ENGINE = false @Provides fun provideInferenceEngine(@ApplicationContext context: Context): InferenceEngine { - return if (USE_REAL_ENGINE) { - LLamaLibraryLoader.createInstance(context) ?: throw InstantiationException("Cannot instantiate LlamaAndroid!") - } else { + return if (USE_STUB_ENGINE) { StubInferenceEngine() + } else { + InferenceEngineLoader.createInstance(context) + ?: throw InstantiationException("Cannot instantiate InferenceEngine!") } } diff --git a/examples/llama.android/app/src/main/res/values/strings.xml b/examples/llama.android/app/src/main/res/values/strings.xml index 7a9d314e29..25c3cc42d2 100644 --- a/examples/llama.android/app/src/main/res/values/strings.xml +++ b/examples/llama.android/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - LlamaAndroid + Kleidi Llama diff --git a/examples/llama.android/app/src/main/res/values/themes.xml b/examples/llama.android/app/src/main/res/values/themes.xml index 8a24fda566..031444ffd7 100644 --- a/examples/llama.android/app/src/main/res/values/themes.xml +++ b/examples/llama.android/app/src/main/res/values/themes.xml @@ -1,5 +1,5 @@ -