Skip to content

Commit eb2d8b6

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
Allow using files from local storage (#2200)
Summary: Pull Request resolved: #2200 This helps us decouple models from the app, so we can use language model. ``` adb push language_llama_xnnpack_kv.pte /data/local/tmp/language.pte adb push flores200sacrebleuspm.bin /data/local/tmp/language.bin ``` Reviewed By: mcr229 Differential Revision: D54427423 fbshipit-source-id: 35ebe58c04c8f817750cee72bdc51834db0d2866
1 parent 566209d commit eb2d8b6

File tree

1 file changed

+5
-1
lines changed
  • examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchdemo

1 file changed

+5
-1
lines changed

examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchdemo/MainActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ private void setModel(String modelPath, String tokenizerPath) {
6868
}
6969
}
7070

71+
private void setLocalModel(String modelPath, String tokenizerPath) {
72+
mModule = new LlamaModule(modelPath, tokenizerPath, 0.8f);
73+
}
74+
7175
private void modelDialog() {
7276
AlertDialog.Builder builder = new AlertDialog.Builder(this);
7377
builder.setTitle("Select a Model");
@@ -81,7 +85,7 @@ public void onClick(android.content.DialogInterface dialog, int item) {
8185
setModel("stories110M.pte", "tokenizer.bin");
8286
break;
8387
case 1:
84-
setModel("language.pte", "language.bin");
88+
setLocalModel("/data/local/tmp/language.pte", "/data/local/tmp/language.bin");
8589
break;
8690
}
8791
mEditTextMessage.setText("");

0 commit comments

Comments
 (0)