Skip to content

Commit

Permalink
fix(android): lora params
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Oct 2, 2023
1 parent ab783b9 commit 5f94406
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion android/src/main/java/com/rnllama/LlamaContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public LlamaContext(int id, ReactApplicationContext reactContext, ReadableMap pa
// String lora,
params.hasKey("lora") ? params.getString("lora") : "",
// float lora_scaled,
params.hasKey("lora_scaled") ? (float) params.getDouble("lora_scaled") : 1.0f
params.hasKey("lora_scaled") ? (float) params.getDouble("lora_scaled") : 1.0f,
// String lora_base,
params.hasKey("lora_base") ? params.getString("lora_base") : "",
// float rope_freq_base,
Expand Down
6 changes: 2 additions & 4 deletions android/src/main/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,10 @@ Java_com_rnllama_LlamaContext_initContext(
defaultParams.memory_f16 = memory_f16;

const char *lora_chars = env->GetStringUTFChars(lora_str, nullptr);
if (lora_chars != nullptr) {
const char *lora_base_chars = env->GetStringUTFChars(lora_base_str, nullptr);
if (!lora_chars) {
defaultParams.lora_adapter.push_back({lora_chars, lora_scaled});

const char *lora_base_chars = env->GetStringUTFChars(lora_base_str, nullptr);
defaultParams.lora_base = lora_base_chars;

defaultParams.use_mmap = false;
}

Expand Down

0 comments on commit 5f94406

Please sign in to comment.