Skip to content

Commit 1ca266a

Browse files
committed
Update base for Update on "Swift support for multiple ptd files"
Differential Revision: [D82075758](https://our.internmc.facebook.com/intern/diff/D82075758/) [ghstack-poisoned]
1 parent f8b0e40 commit 1ca266a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@ public class LlmModule {
3333

3434
@DoNotStrip
3535
private static native HybridData initHybrid(
36-
int modelType, String modulePath, String tokenizerPath, float temperature, List<String> dataFiles);
36+
int modelType,
37+
String modulePath,
38+
String tokenizerPath,
39+
float temperature,
40+
List<String> dataFiles);
3741

3842
/**
3943
* Constructs a LLM Module for a model with given type, model path, tokenizer, temperature, and
4044
* dataFiles.
4145
*/
4246
public LlmModule(
43-
int modelType, String modulePath, String tokenizerPath, float temperature, List<String> dataFiles) {
47+
int modelType,
48+
String modulePath,
49+
String tokenizerPath,
50+
float temperature,
51+
List<String> dataFiles) {
4452
ExecuTorchRuntime runtime = ExecuTorchRuntime.getRuntime();
4553

4654
File modelFile = new File(modulePath);
@@ -51,7 +59,7 @@ public LlmModule(
5159
if (!tokenizerFile.canRead() || !tokenizerFile.isFile()) {
5260
throw new RuntimeException("Cannot load tokenizer path " + tokenizerPath);
5361
}
54-
62+
5563
mHybridData = initHybrid(modelType, modulePath, tokenizerPath, temperature, dataFiles);
5664
}
5765

@@ -61,7 +69,7 @@ public LlmModule(
6169
*/
6270
public LlmModule(
6371
int modelType, String modulePath, String tokenizerPath, float temperature, String dataPath) {
64-
this(modelType, modulePath, tokenizerPath, temperature, List.of(dataPath));
72+
this(modelType, modulePath, tokenizerPath, temperature, List.of(dataPath));
6573
}
6674

6775
/** Constructs a LLM Module for a model with given model path, tokenizer, temperature. */

extension/android/jni/jni_layer_llama.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class ExecuTorchLlmJni : public facebook::jni::HybridClass<ExecuTorchLlmJni> {
174174
llm::load_tokenizer(tokenizer_path->toStdString()));
175175
} else if (model_type_category == MODEL_TYPE_CATEGORY_LLM) {
176176
std::vector<std::string> data_files_vector;
177-
if (data_files_vector != nullptr) {
177+
if (data_files != nullptr) {
178178
// Convert Java List<String> to C++ std::vector<string>
179179
auto list_class = facebook::jni::findClassStatic("java/util/List");
180180
auto size_method = list_class->getMethod<jint()>("size");

0 commit comments

Comments
 (0)