Skip to content

Commit d6cf749

Browse files
pytorchbotRiandy
andauthored
Add llama 3.2 model type on Android (#5699)
Add llama 3.2 model type on Android (#5646) Summary: Pull Request resolved: #5646 Adding 3.2 model type on android app Reviewed By: kirklandsign Differential Revision: D63404583 fbshipit-source-id: 57c79b120b11cd6a814cf56107c76165fdf04f91 (cherry picked from commit dacbba7) Co-authored-by: Riandy Riandy <[email protected]>
1 parent 570572b commit d6cf749

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ModelType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
public enum ModelType {
1212
LLAMA_3,
1313
LLAMA_3_1,
14+
LLAMA_3_2,
1415
LLAVA_1_5,
1516
LLAMA_GUARD_3,
1617
}

examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/ModelUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public static int getModelCategory(ModelType modelType) {
2121
return VISION_MODEL;
2222
case LLAMA_3:
2323
case LLAMA_3_1:
24+
case LLAMA_3_2:
2425
default:
2526
return TEXT_MODEL;
2627
}

examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/PromptFormat.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static String getSystemPromptTemplate(ModelType modelType) {
1919
switch (modelType) {
2020
case LLAMA_3:
2121
case LLAMA_3_1:
22+
case LLAMA_3_2:
2223
return "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n"
2324
+ SYSTEM_PLACEHOLDER
2425
+ "<|eot_id|>";
@@ -33,6 +34,7 @@ public static String getUserPromptTemplate(ModelType modelType) {
3334
switch (modelType) {
3435
case LLAMA_3:
3536
case LLAMA_3_1:
37+
case LLAMA_3_2:
3638
case LLAMA_GUARD_3:
3739
return "<|start_header_id|>user<|end_header_id|>\n"
3840
+ USER_PLACEHOLDER
@@ -49,6 +51,7 @@ public static String getConversationFormat(ModelType modelType) {
4951
switch (modelType) {
5052
case LLAMA_3:
5153
case LLAMA_3_1:
54+
case LLAMA_3_2:
5255
return getUserPromptTemplate(modelType) + "\n" + ASSISTANT_PLACEHOLDER + "<|eot_id|>";
5356
case LLAVA_1_5:
5457
return USER_PLACEHOLDER + " ASSISTANT:";
@@ -61,6 +64,7 @@ public static String getStopToken(ModelType modelType) {
6164
switch (modelType) {
6265
case LLAMA_3:
6366
case LLAMA_3_1:
67+
case LLAMA_3_2:
6468
case LLAMA_GUARD_3:
6569
return "<|eot_id|>";
6670
case LLAVA_1_5:

0 commit comments

Comments
 (0)