Skip to content

Commit 12048f2

Browse files
Add support for Gemma3
1 parent 40d75f4 commit 12048f2

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

examples/llm_inference/android/app/src/main/java/com/google/mediapipe/examples/llminference/InferenceModel.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class InferenceModel private constructor(context: Context) {
102102
}
103103

104104
companion object {
105-
var model: Model = Model.GEMMA_CPU
105+
var model: Model = Model.GEMMA3_CPU
106106
private var instance: InferenceModel? = null
107107

108108
fun getInstance(context: Context): InferenceModel {

examples/llm_inference/android/app/src/main/java/com/google/mediapipe/examples/llminference/Model.kt

+18-18
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ enum class Model(
1616
val topK: Int,
1717
val topP: Float,
1818
) {
19-
GEMMA_CPU(
20-
path = "/data/local/tmp/llm/gemma-2b-it-cpu-int4.bin",
21-
url = "https://huggingface.co/litert-community/Gemma2-2B-IT/resolve/main/gemma2_q8_multi-prefill-seq_ekv1280.task",
22-
licenseUrl = "https://huggingface.co/litert-community/Gemma2-2B-IT",
19+
GEMMA3_CPU(
20+
path = "/data/local/tmp/gemma3-1b-it-int4.task",
21+
url = "https://huggingface.co/litert-community/Gemma3-1B-IT/resolve/main/gemma3-1b-it-int4.task?download=true",
22+
licenseUrl = "https://huggingface.co/litert-community/Gemma3-1B-IT",
2323
needsAuth = true,
24-
preferredBackend = null,
25-
uiState = GemmaUiState(),
26-
temperature = 0.8f,
27-
topK = 40,
28-
topP = 1.0f
24+
preferredBackend = Backend.CPU,
25+
uiState = GenericUiState(),
26+
temperature = 1f,
27+
topK = 64,
28+
topP = 0.95f
2929
),
30-
GEMMA_GPU(
31-
path = "/data/local/tmp/llm/gemma-2b-it-gpu-int4.bin",
32-
url = "",
33-
licenseUrl = "",
30+
GEMMA3_GPU(
31+
path = "/data/local/tmp/gemma3-1b-it-int4.task",
32+
url = "https://huggingface.co/litert-community/Gemma3-1B-IT/resolve/main/gemma3-1b-it-int4.task?download=true",
33+
licenseUrl = "https://huggingface.co/litert-community/Gemma3-1B-IT",
3434
needsAuth = true,
35-
preferredBackend = null,
36-
uiState = GemmaUiState(),
37-
temperature = 0.8f,
38-
topK = 40,
39-
topP = 1.0f
35+
preferredBackend = Backend.GPU,
36+
uiState = GenericUiState(),
37+
temperature = 1f,
38+
topK = 64,
39+
topP = 0.95f
4040
),
4141
DEEPSEEK_CPU(
4242
path = "/data/local/tmp/llm/deepseek3k_q8_ekv1280.task",

0 commit comments

Comments
 (0)