From 96e8e9a5361d4a4f3e7f94dd65cc76700b282afa Mon Sep 17 00:00:00 2001 From: jhen Date: Sat, 27 Jul 2024 14:31:34 +0800 Subject: [PATCH] feat: remove lora_base --- .../main/java/com/rnllama/LlamaContext.java | 3 -- android/src/main/jni.cpp | 4 --- cpp/ggml.c.rej | 13 -------- docs/API/README.md | 16 +++++----- docs/API/classes/LlamaContext.md | 28 ++++++++-------- docs/API/classes/SchemaGrammarConverter.md | 32 +++++++++---------- example/ios/.xcode.env.local | 2 +- example/ios/Podfile.lock | 4 +-- ios/RNLlamaContext.mm | 1 - src/NativeRNLlama.ts | 1 - 10 files changed, 41 insertions(+), 63 deletions(-) delete mode 100644 cpp/ggml.c.rej diff --git a/android/src/main/java/com/rnllama/LlamaContext.java b/android/src/main/java/com/rnllama/LlamaContext.java index dad6fb5e..b28d0311 100644 --- a/android/src/main/java/com/rnllama/LlamaContext.java +++ b/android/src/main/java/com/rnllama/LlamaContext.java @@ -57,8 +57,6 @@ public LlamaContext(int id, ReactApplicationContext reactContext, ReadableMap pa params.hasKey("lora") ? params.getString("lora") : "", // float lora_scaled, 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, params.hasKey("rope_freq_base") ? (float) params.getDouble("rope_freq_base") : 0.0f, // float rope_freq_scale @@ -306,7 +304,6 @@ protected static native long initContext( boolean use_mmap, String lora, float lora_scaled, - String lora_base, float rope_freq_base, float rope_freq_scale ); diff --git a/android/src/main/jni.cpp b/android/src/main/jni.cpp index f92cc497..ed171c9b 100644 --- a/android/src/main/jni.cpp +++ b/android/src/main/jni.cpp @@ -131,7 +131,6 @@ Java_com_rnllama_LlamaContext_initContext( jboolean use_mmap, jstring lora_str, jfloat lora_scaled, - jstring lora_base_str, jfloat rope_freq_base, jfloat rope_freq_scale ) { @@ -158,10 +157,8 @@ Java_com_rnllama_LlamaContext_initContext( defaultParams.use_mmap = use_mmap; const char *lora_chars = env->GetStringUTFChars(lora_str, nullptr); - const char *lora_base_chars = env->GetStringUTFChars(lora_base_str, nullptr); if (lora_chars != nullptr && lora_chars[0] != '\0') { defaultParams.lora_adapter.push_back({lora_chars, lora_scaled}); - // defaultParams.lora_base = lora_base_chars; defaultParams.use_mmap = false; } @@ -180,7 +177,6 @@ Java_com_rnllama_LlamaContext_initContext( env->ReleaseStringUTFChars(model_path_str, model_path_chars); env->ReleaseStringUTFChars(lora_str, lora_chars); - env->ReleaseStringUTFChars(lora_base_str, lora_base_chars); return reinterpret_cast(llama->ctx); } diff --git a/cpp/ggml.c.rej b/cpp/ggml.c.rej deleted file mode 100644 index 45fd6684..00000000 --- a/cpp/ggml.c.rej +++ /dev/null @@ -1,13 +0,0 @@ -@@ -144,9 +144,9 @@ - #if defined(__linux__) - #include - static void lm_ggml_print_backtrace_symbols(void) { -- void * trace[100]; -- int nptrs = backtrace(trace, sizeof(trace)/sizeof(trace[0])); -- backtrace_symbols_fd(trace, nptrs, STDERR_FILENO); -+ // void * trace[100]; -+ // int nptrs = backtrace(trace, sizeof(trace)/sizeof(trace[0])); -+ // backtrace_symbols_fd(trace, nptrs, STDERR_FILENO); - } - #else - static void lm_ggml_print_backtrace_symbols(void) { diff --git a/docs/API/README.md b/docs/API/README.md index c1815459..b998afd3 100644 --- a/docs/API/README.md +++ b/docs/API/README.md @@ -43,7 +43,7 @@ llama.rn #### Defined in -[index.ts:43](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L43) +[index.ts:43](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L43) ___ @@ -53,7 +53,7 @@ ___ #### Defined in -[index.ts:41](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L41) +[index.ts:41](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L41) ___ @@ -63,7 +63,7 @@ ___ #### Defined in -[index.ts:39](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L39) +[index.ts:39](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L39) ___ @@ -80,7 +80,7 @@ ___ #### Defined in -[index.ts:29](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L29) +[index.ts:29](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L29) ## Functions @@ -104,7 +104,7 @@ ___ #### Defined in -[grammar.ts:824](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L824) +[grammar.ts:824](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L824) ___ @@ -124,7 +124,7 @@ ___ #### Defined in -[index.ts:165](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L165) +[index.ts:166](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L166) ___ @@ -138,7 +138,7 @@ ___ #### Defined in -[index.ts:181](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L181) +[index.ts:182](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L182) ___ @@ -158,4 +158,4 @@ ___ #### Defined in -[index.ts:161](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L161) +[index.ts:162](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L162) diff --git a/docs/API/classes/LlamaContext.md b/docs/API/classes/LlamaContext.md index e789da5e..984bc1d0 100644 --- a/docs/API/classes/LlamaContext.md +++ b/docs/API/classes/LlamaContext.md @@ -41,7 +41,7 @@ #### Defined in -[index.ts:62](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L62) +[index.ts:62](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L62) ## Properties @@ -51,7 +51,7 @@ #### Defined in -[index.ts:56](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L56) +[index.ts:56](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L56) ___ @@ -61,7 +61,7 @@ ___ #### Defined in -[index.ts:54](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L54) +[index.ts:54](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L54) ___ @@ -71,7 +71,7 @@ ___ #### Defined in -[index.ts:60](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L60) +[index.ts:60](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L60) ___ @@ -81,7 +81,7 @@ ___ #### Defined in -[index.ts:58](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L58) +[index.ts:58](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L58) ## Methods @@ -104,7 +104,7 @@ ___ #### Defined in -[index.ts:134](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L134) +[index.ts:135](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L135) ___ @@ -125,7 +125,7 @@ ___ #### Defined in -[index.ts:89](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L89) +[index.ts:90](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L90) ___ @@ -145,7 +145,7 @@ ___ #### Defined in -[index.ts:126](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L126) +[index.ts:127](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L127) ___ @@ -165,7 +165,7 @@ ___ #### Defined in -[index.ts:130](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L130) +[index.ts:131](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L131) ___ @@ -187,7 +187,7 @@ Load cached prompt & completion state from a file. #### Defined in -[index.ts:78](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L78) +[index.ts:77](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L77) ___ @@ -201,7 +201,7 @@ ___ #### Defined in -[index.ts:156](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L156) +[index.ts:157](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L157) ___ @@ -225,7 +225,7 @@ Save current cached prompt & completion state to a file. #### Defined in -[index.ts:85](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L85) +[index.ts:86](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L86) ___ @@ -239,7 +239,7 @@ ___ #### Defined in -[index.ts:118](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L118) +[index.ts:119](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L119) ___ @@ -259,4 +259,4 @@ ___ #### Defined in -[index.ts:122](https://github.com/mybigday/llama.rn/blob/a2b459e/src/index.ts#L122) +[index.ts:123](https://github.com/mybigday/llama.rn/blob/f95f600/src/index.ts#L123) diff --git a/docs/API/classes/SchemaGrammarConverter.md b/docs/API/classes/SchemaGrammarConverter.md index 33088e17..8b9a535f 100644 --- a/docs/API/classes/SchemaGrammarConverter.md +++ b/docs/API/classes/SchemaGrammarConverter.md @@ -46,7 +46,7 @@ #### Defined in -[grammar.ts:211](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L211) +[grammar.ts:211](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L211) ## Properties @@ -56,7 +56,7 @@ #### Defined in -[grammar.ts:201](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L201) +[grammar.ts:201](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L201) ___ @@ -66,7 +66,7 @@ ___ #### Defined in -[grammar.ts:203](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L203) +[grammar.ts:203](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L203) ___ @@ -76,7 +76,7 @@ ___ #### Defined in -[grammar.ts:199](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L199) +[grammar.ts:199](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L199) ___ @@ -90,7 +90,7 @@ ___ #### Defined in -[grammar.ts:207](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L207) +[grammar.ts:207](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L207) ___ @@ -100,7 +100,7 @@ ___ #### Defined in -[grammar.ts:209](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L209) +[grammar.ts:209](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L209) ___ @@ -114,7 +114,7 @@ ___ #### Defined in -[grammar.ts:205](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L205) +[grammar.ts:205](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L205) ## Methods @@ -135,7 +135,7 @@ ___ #### Defined in -[grammar.ts:693](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L693) +[grammar.ts:693](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L693) ___ @@ -156,7 +156,7 @@ ___ #### Defined in -[grammar.ts:224](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L224) +[grammar.ts:224](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L224) ___ @@ -179,7 +179,7 @@ ___ #### Defined in -[grammar.ts:710](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L710) +[grammar.ts:710](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L710) ___ @@ -200,7 +200,7 @@ ___ #### Defined in -[grammar.ts:312](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L312) +[grammar.ts:312](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L312) ___ @@ -220,7 +220,7 @@ ___ #### Defined in -[grammar.ts:518](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L518) +[grammar.ts:518](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L518) ___ @@ -241,7 +241,7 @@ ___ #### Defined in -[grammar.ts:323](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L323) +[grammar.ts:323](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L323) ___ @@ -255,7 +255,7 @@ ___ #### Defined in -[grammar.ts:813](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L813) +[grammar.ts:813](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L813) ___ @@ -276,7 +276,7 @@ ___ #### Defined in -[grammar.ts:247](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L247) +[grammar.ts:247](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L247) ___ @@ -297,4 +297,4 @@ ___ #### Defined in -[grammar.ts:529](https://github.com/mybigday/llama.rn/blob/a2b459e/src/grammar.ts#L529) +[grammar.ts:529](https://github.com/mybigday/llama.rn/blob/f95f600/src/grammar.ts#L529) diff --git a/example/ios/.xcode.env.local b/example/ios/.xcode.env.local index 1cb33d66..92bcef1f 100644 --- a/example/ios/.xcode.env.local +++ b/example/ios/.xcode.env.local @@ -1 +1 @@ -export NODE_BINARY=/var/folders/4z/1d45cfts3936kdm7v9jl349r0000gn/T/yarn--1716945640903-0.9230388944694827/node +export NODE_BINARY=/var/folders/4z/1d45cfts3936kdm7v9jl349r0000gn/T/yarn--1722061680584-0.19771203690487615/node diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index ad7c273e..e5e2c512 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -8,7 +8,7 @@ PODS: - hermes-engine/Pre-built (= 0.72.3) - hermes-engine/Pre-built (0.72.3) - libevent (2.1.12) - - llama-rn (0.3.1): + - llama-rn (0.3.4): - RCT-Folly - RCTRequired - RCTTypeSafety @@ -1261,7 +1261,7 @@ SPEC CHECKSUMS: glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b hermes-engine: 10fbd3f62405c41ea07e71973ea61e1878d07322 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - llama-rn: c18368a2c6c8c20dc3e19fb7213b6225330c9156 + llama-rn: 1facf2ce116e23e89a526e30439f151eb03f460d RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 RCTRequired: a2faf4bad4e438ca37b2040cb8f7799baa065c18 RCTTypeSafety: cb09f3e4747b6d18331a15eb05271de7441ca0b3 diff --git a/ios/RNLlamaContext.mm b/ios/RNLlamaContext.mm index 58819f2a..4341862d 100644 --- a/ios/RNLlamaContext.mm +++ b/ios/RNLlamaContext.mm @@ -62,7 +62,6 @@ + (instancetype)initWithParams:(NSDictionary *)params { defaultParams.lora_adapter.push_back({[params[@"lora"] UTF8String], lora_scaled}); defaultParams.use_mmap = false; } - if (params[@"lora_base"]) defaultParams.lora_base = [params[@"lora_base"] UTF8String]; if (params[@"rope_freq_base"]) defaultParams.rope_freq_base = [params[@"rope_freq_base"] floatValue]; if (params[@"rope_freq_scale"]) defaultParams.rope_freq_scale = [params[@"rope_freq_scale"] floatValue]; diff --git a/src/NativeRNLlama.ts b/src/NativeRNLlama.ts index 7ec08de2..284de67b 100644 --- a/src/NativeRNLlama.ts +++ b/src/NativeRNLlama.ts @@ -18,7 +18,6 @@ export type NativeContextParams = { lora?: string // lora_adaptor lora_scaled?: number - lora_base?: string rope_freq_base?: number rope_freq_scale?: number