File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ public void onResult(String result) {
9090 if (result .equals (PromptFormat .getStopToken (mCurrentSettingsFields .getModelType ()))) {
9191 return ;
9292 }
93+ if (PromptFormat .shouldSkipToken (mCurrentSettingsFields .getModelType (), result )) {
94+ return ;
95+ }
9396 if (result .equals ("\n \n " ) || result .equals ("\n " )) {
9497 if (!mResultMessage .getText ().isEmpty ()) {
9598 mResultMessage .appendText (result );
Original file line number Diff line number Diff line change @@ -86,6 +86,15 @@ public static String getStopToken(ModelType modelType) {
8686 }
8787 }
8888
89+ public static boolean shouldSkipToken (ModelType modelType , String token ) {
90+ switch (modelType ) {
91+ case QWEN_3 :
92+ return token .equals ("<|im_end|>" );
93+ default :
94+ return false ;
95+ }
96+ }
97+
8998 public static String getLlavaPresetPrompt () {
9099 return "A chat between a curious human and an artificial intelligence assistant. The assistant"
91100 + " gives helpful, detailed, and polite answers to the human's questions. USER: " ;
You can’t perform that action at this time.
0 commit comments