Skip to content

Commit 98e51dd

Browse files
Riandyfacebook-github-bot
authored andcommitted
Add model files support for android tokenizer
Summary: Add model files support for android tokenizer. Previously we only support .bin files, but since the runner also supports .model now, updating the app side logic to allow .model tokenizer files. Differential Revision: D63491811
1 parent 8f3a83b commit 98e51dd

File tree

1 file changed

+4
-2
lines changed
  • examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private static String[] listLocalFile(String path, String suffix) {
315315
}
316316
return result;
317317
}
318-
return null;
318+
return new String[] {};
319319
}
320320

321321
private void setupModelTypeSelectorDialog() {
@@ -343,8 +343,10 @@ private void setupModelTypeSelectorDialog() {
343343

344344
private void setupTokenizerSelectorDialog() {
345345
String[] binFiles = listLocalFile("/data/local/tmp/llama/", ".bin");
346-
String[] tokenizerFiles = new String[binFiles.length];
346+
String[] modelFiles = listLocalFile("/data/local/tmp/llama/", ".model");
347+
String[] tokenizerFiles = new String[binFiles.length + modelFiles.length];
347348
System.arraycopy(binFiles, 0, tokenizerFiles, 0, binFiles.length);
349+
System.arraycopy(modelFiles, 0, tokenizerFiles, binFiles.length, modelFiles.length);
348350
AlertDialog.Builder tokenizerPathBuilder = new AlertDialog.Builder(this);
349351
tokenizerPathBuilder.setTitle("Select tokenizer path");
350352
tokenizerPathBuilder.setSingleChoiceItems(

0 commit comments

Comments
 (0)