Skip to content

Commit

Permalink
fix: migrate from api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Aug 23, 2024
1 parent 9df1936 commit 2ed24b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion android/src/main/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Java_com_rnllama_LlamaContext_initContext(

const char *lora_chars = env->GetStringUTFChars(lora_str, nullptr);
if (lora_chars != nullptr && lora_chars[0] != '\0') {
defaultParams.lora_adapter.push_back({lora_chars, lora_scaled});
defaultParams.lora_adapters.push_back({lora_chars, lora_scaled});
defaultParams.use_mmap = false;
}

Expand Down
4 changes: 3 additions & 1 deletion cpp/rn-llama.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ struct llama_rn_context
bool loadModel(gpt_params &params_)
{
params = params_;
std::tie(model, ctx) = llama_init_from_gpt_params(params);
llama_init_result llama_init = llama_init_from_gpt_params(params);
model = llama_init.model;
ctx = llama_init.context;
if (model == nullptr)
{
LOG_ERROR("unable to load model: %s", params_.model.c_str());
Expand Down
2 changes: 1 addition & 1 deletion ios/RNLlamaContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ + (instancetype)initWithParams:(NSDictionary *)params {
if (params[@"lora"]) {
float lora_scaled = 1.0f;
if (params[@"lora_scaled"]) lora_scaled = [params[@"lora_scaled"] floatValue];
defaultParams.lora_adapter.push_back({[params[@"lora"] UTF8String], lora_scaled});
defaultParams.lora_adapters.push_back({[params[@"lora"] UTF8String], lora_scaled});
defaultParams.use_mmap = false;
}

Expand Down

0 comments on commit 2ed24b9

Please sign in to comment.