Skip to content

LlamaDemo Android add Qwen 3 prompt format #10624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ public enum ModelType {
LLAMA_3_2,
LLAVA_1_5,
LLAMA_GUARD_3,
QWEN_3,
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static int getModelCategory(ModelType modelType, BackendType backendType)
case LLAMA_3:
case LLAMA_3_1:
case LLAMA_3_2:
case QWEN_3:
default:
return TEXT_MODEL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static String getSystemPromptTemplate(ModelType modelType) {
+ "<|eot_id|>";
case LLAVA_1_5:
return "USER: ";
case QWEN_3:
return "<|im_start|>system\n" + "You are a helpful assistant.\n" + "<|im_end|>\n";
default:
return SYSTEM_PLACEHOLDER;
}
Expand All @@ -42,6 +44,14 @@ public static String getUserPromptTemplate(ModelType modelType) {
+ "<|start_header_id|>assistant<|end_header_id|>";

case LLAVA_1_5:
case QWEN_3:
return "<|im_start|>user\n"
+ USER_PLACEHOLDER
+ "<|im_end|>\n"
+ "<|im_start|>assistant\n"
+ "<think>\n"
+ "\n"
+ "</think>\n\n\n";
default:
return USER_PLACEHOLDER;
}
Expand Down Expand Up @@ -69,6 +79,8 @@ public static String getStopToken(ModelType modelType) {
return "<|eot_id|>";
case LLAVA_1_5:
return "</s>";
case QWEN_3:
return "<|endoftext|>";
default:
return "";
}
Expand Down
Loading