cui-llama.rn 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -23
- package/android/build.gradle +12 -3
- package/android/src/main/CMakeLists.txt +13 -7
- package/android/src/main/java/com/rnllama/LlamaContext.java +27 -20
- package/android/src/main/java/com/rnllama/RNLlama.java +5 -1
- package/android/src/main/jni.cpp +15 -12
- package/android/src/main/jniLibs/arm64-v8a/librnllama.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librnllama_v8.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librnllama_v8_2.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librnllama_v8_2_dotprod.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librnllama_v8_2_dotprod_i8mm.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librnllama_v8_2_i8mm.so +0 -0
- package/android/src/main/jniLibs/x86_64/librnllama.so +0 -0
- package/android/src/main/jniLibs/x86_64/librnllama_x86_64.so +0 -0
- package/cpp/README.md +1 -1
- package/cpp/common.cpp +158 -267
- package/cpp/common.h +46 -12
- package/cpp/ggml-alloc.c +1042 -1037
- package/cpp/ggml-backend-impl.h +255 -256
- package/cpp/ggml-backend-reg.cpp +582 -582
- package/cpp/ggml-backend.cpp +2002 -2002
- package/cpp/ggml-backend.h +354 -352
- package/cpp/ggml-common.h +1853 -1853
- package/cpp/ggml-cpp.h +39 -39
- package/cpp/ggml-cpu-aarch64.cpp +4247 -4247
- package/cpp/ggml-cpu-aarch64.h +8 -8
- package/cpp/ggml-cpu-impl.h +386 -386
- package/cpp/ggml-cpu-quants.c +10920 -10839
- package/cpp/ggml-cpu-traits.cpp +36 -36
- package/cpp/ggml-cpu-traits.h +38 -38
- package/cpp/ggml-cpu.c +329 -60
- package/cpp/ggml-cpu.cpp +10 -2
- package/cpp/ggml-cpu.h +135 -135
- package/cpp/ggml-impl.h +567 -567
- package/cpp/ggml-metal-impl.h +17 -17
- package/cpp/ggml-metal.m +4884 -4884
- package/cpp/ggml-quants.c +5238 -5238
- package/cpp/ggml-threading.h +14 -14
- package/cpp/ggml.c +6514 -6448
- package/cpp/ggml.h +2194 -2163
- package/cpp/gguf.cpp +1329 -1325
- package/cpp/gguf.h +202 -202
- package/cpp/json-schema-to-grammar.cpp +1045 -1045
- package/cpp/json-schema-to-grammar.h +8 -8
- package/cpp/json.hpp +24766 -24766
- package/cpp/llama-adapter.cpp +347 -346
- package/cpp/llama-adapter.h +74 -73
- package/cpp/llama-arch.cpp +1487 -1434
- package/cpp/llama-arch.h +400 -395
- package/cpp/llama-batch.cpp +368 -368
- package/cpp/llama-batch.h +88 -88
- package/cpp/llama-chat.cpp +578 -567
- package/cpp/llama-chat.h +52 -51
- package/cpp/llama-context.cpp +1775 -1771
- package/cpp/llama-context.h +128 -128
- package/cpp/llama-cparams.cpp +1 -1
- package/cpp/llama-cparams.h +37 -37
- package/cpp/llama-cpp.h +30 -30
- package/cpp/llama-grammar.cpp +1139 -1139
- package/cpp/llama-grammar.h +143 -143
- package/cpp/llama-hparams.cpp +71 -71
- package/cpp/llama-hparams.h +139 -140
- package/cpp/llama-impl.cpp +167 -167
- package/cpp/llama-impl.h +61 -61
- package/cpp/llama-kv-cache.cpp +718 -718
- package/cpp/llama-kv-cache.h +218 -218
- package/cpp/llama-mmap.cpp +2 -1
- package/cpp/llama-mmap.h +67 -67
- package/cpp/llama-model-loader.cpp +1124 -1011
- package/cpp/llama-model-loader.h +167 -158
- package/cpp/llama-model.cpp +3997 -2202
- package/cpp/llama-model.h +370 -391
- package/cpp/llama-sampling.cpp +2408 -2406
- package/cpp/llama-sampling.h +32 -48
- package/cpp/llama-vocab.cpp +3247 -1982
- package/cpp/llama-vocab.h +125 -182
- package/cpp/llama.cpp +416 -2886
- package/cpp/llama.h +1323 -1285
- package/cpp/log.cpp +401 -401
- package/cpp/log.h +121 -121
- package/cpp/rn-llama.cpp +822 -0
- package/cpp/rn-llama.h +123 -0
- package/cpp/rn-llama.hpp +18 -12
- package/cpp/sampling.cpp +505 -500
- package/cpp/sgemm.cpp +2597 -2597
- package/cpp/speculative.cpp +277 -274
- package/cpp/speculative.h +28 -28
- package/cpp/unicode.cpp +2 -3
- package/ios/CMakeLists.txt +99 -0
- package/ios/RNLlama.h +5 -1
- package/ios/RNLlama.mm +2 -2
- package/ios/RNLlamaContext.h +8 -1
- package/ios/RNLlamaContext.mm +15 -11
- package/ios/rnllama.xcframework/Info.plist +74 -0
- package/jest/mock.js +3 -2
- package/lib/commonjs/NativeRNLlama.js.map +1 -1
- package/lib/commonjs/index.js +4 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeRNLlama.js.map +1 -1
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/NativeRNLlama.d.ts +5 -1
- package/lib/typescript/NativeRNLlama.d.ts.map +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/llama-rn.podspec +8 -2
- package/package.json +5 -2
- package/src/NativeRNLlama.ts +5 -1
- package/src/index.ts +9 -2
package/README.md
CHANGED
@@ -36,6 +36,8 @@ npm install llama.rn
|
|
36
36
|
|
37
37
|
Please re-run `npx pod-install` again.
|
38
38
|
|
39
|
+
By default, `llama.rn` will use pre-built `rnllama.xcframework` for iOS. If you want to build from source, please set `RNLLAMA_BUILD_FROM_SOURCE` to `1` in your Podfile.
|
40
|
+
|
39
41
|
#### Android
|
40
42
|
|
41
43
|
Add proguard rule if it's enabled in project (android/app/proguard-rules.pro):
|
@@ -45,6 +47,8 @@ Add proguard rule if it's enabled in project (android/app/proguard-rules.pro):
|
|
45
47
|
-keep class com.rnllama.** { *; }
|
46
48
|
```
|
47
49
|
|
50
|
+
By default, `llama.rn` will use pre-built libraries for Android. If you want to build from source, please set `rnllamaBuildFromSource` to `true` in `android/gradle.properties`.
|
51
|
+
|
48
52
|
## Obtain the model
|
49
53
|
|
50
54
|
You can search HuggingFace for available models (Keyword: [`GGUF`](https://huggingface.co/search/full-text?q=GGUF&type=model)).
|
@@ -137,29 +141,6 @@ Please visit the [Documentation](docs/API) for more details.
|
|
137
141
|
|
138
142
|
You can also visit the [example](example) to see how to use it.
|
139
143
|
|
140
|
-
Run the example:
|
141
|
-
|
142
|
-
```bash
|
143
|
-
yarn && yarn bootstrap
|
144
|
-
|
145
|
-
# iOS
|
146
|
-
yarn example ios
|
147
|
-
# Use device
|
148
|
-
yarn example ios --device "<device name>"
|
149
|
-
# With release mode
|
150
|
-
yarn example ios --mode Release
|
151
|
-
|
152
|
-
# Android
|
153
|
-
yarn example android
|
154
|
-
# With release mode
|
155
|
-
yarn example android --mode release
|
156
|
-
```
|
157
|
-
|
158
|
-
This example used [react-native-document-picker](https://github.com/rnmods/react-native-document-picker) for select model.
|
159
|
-
|
160
|
-
- iOS: You can move the model to iOS Simulator, or iCloud for real device.
|
161
|
-
- Android: Selected file will be copied or downloaded to cache directory so it may be slow.
|
162
|
-
|
163
144
|
## Grammar Sampling
|
164
145
|
|
165
146
|
GBNF (GGML BNF) is a format for defining [formal grammars](https://en.wikipedia.org/wiki/Formal_grammar) to constrain model outputs in `llama.cpp`. For example, you can use it to force the model to generate valid JSON, or speak only in emojis.
|
package/android/build.gradle
CHANGED
@@ -54,9 +54,18 @@ android {
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
def rnllamaBuildFromSource = project.properties["rnllamaBuildFromSource"]
|
58
|
+
if (rnllamaBuildFromSource == "true") {
|
59
|
+
externalNativeBuild {
|
60
|
+
cmake {
|
61
|
+
path = file('src/main/CMakeLists.txt')
|
62
|
+
}
|
63
|
+
}
|
64
|
+
// Exclude jniLibs
|
65
|
+
sourceSets {
|
66
|
+
main {
|
67
|
+
jniLibs.srcDirs = []
|
68
|
+
}
|
60
69
|
}
|
61
70
|
}
|
62
71
|
buildTypes {
|
@@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.10)
|
|
2
2
|
|
3
3
|
project(llama.rn)
|
4
4
|
|
5
|
+
find_program(CCACHE_FOUND ccache)
|
6
|
+
if(CCACHE_FOUND)
|
7
|
+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
8
|
+
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
9
|
+
endif(CCACHE_FOUND)
|
10
|
+
|
5
11
|
set(CMAKE_CXX_STANDARD 17)
|
6
12
|
set(RNLLAMA_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../cpp)
|
7
13
|
|
@@ -45,7 +51,7 @@ set(
|
|
45
51
|
${RNLLAMA_LIB_DIR}/unicode.cpp
|
46
52
|
${RNLLAMA_LIB_DIR}/sgemm.cpp
|
47
53
|
${RNLLAMA_LIB_DIR}/common.cpp
|
48
|
-
${RNLLAMA_LIB_DIR}/rn-llama.
|
54
|
+
${RNLLAMA_LIB_DIR}/rn-llama.cpp
|
49
55
|
${CMAKE_SOURCE_DIR}/jni-utils.h
|
50
56
|
${CMAKE_SOURCE_DIR}/jni.cpp
|
51
57
|
)
|
@@ -86,13 +92,13 @@ build_library("rnllama" "")
|
|
86
92
|
|
87
93
|
if (${ANDROID_ABI} STREQUAL "arm64-v8a")
|
88
94
|
# ARM64 targets
|
89
|
-
|
90
|
-
|
91
|
-
build_library("rnllama_v8_4_fp16_dotprod_i8mm" "-march=armv8.4-a+fp16+dotprod+i8mm")
|
92
|
-
build_library("rnllama_v8_4_fp16_dotprod" "-march=armv8.4-a+fp16+dotprod")
|
93
|
-
build_library("rnllama_v8_2_fp16_dotprod" "-march=armv8.2-a+fp16+dotprod")
|
94
|
-
build_library("rnllama_v8_2_fp16" "-march=armv8.2-a+fp16")
|
95
|
+
# Removing fp16 for now as it leads to issues with some models like deepseek r1 distills
|
96
|
+
# https://github.com/mybigday/llama.rn/pull/110#issuecomment-2609918310
|
95
97
|
build_library("rnllama_v8" "-march=armv8-a")
|
98
|
+
build_library("rnllama_v8_2" "-march=armv8.2-a")
|
99
|
+
build_library("rnllama_v8_2_dotprod" "-march=armv8.2-a+dotprod")
|
100
|
+
build_library("rnllama_v8_2_i8mm" "-march=armv8.2-a+i8mm")
|
101
|
+
build_library("rnllama_v8_2_dotprod_i8mm" "-march=armv8.2-a+dotprod+i8mm")
|
96
102
|
|
97
103
|
# https://github.com/ggerganov/llama.cpp/blob/master/docs/android.md#cross-compile-using-android-ndk
|
98
104
|
# llama.cpp will deal with the cpu features
|
@@ -26,6 +26,8 @@ import java.io.FileInputStream;
|
|
26
26
|
public class LlamaContext {
|
27
27
|
public static final String NAME = "RNLlamaContext";
|
28
28
|
|
29
|
+
private static String loadedLibrary = "";
|
30
|
+
|
29
31
|
private int id;
|
30
32
|
private ReactApplicationContext reactContext;
|
31
33
|
private long context;
|
@@ -160,6 +162,10 @@ public class LlamaContext {
|
|
160
162
|
return modelDetails;
|
161
163
|
}
|
162
164
|
|
165
|
+
public String getLoadedLibrary() {
|
166
|
+
return loadedLibrary;
|
167
|
+
}
|
168
|
+
|
163
169
|
public String getFormattedChat(ReadableArray messages, String chatTemplate) {
|
164
170
|
ReadableMap[] msgs = new ReadableMap[messages.size()];
|
165
171
|
for (int i = 0; i < messages.size(); i++) {
|
@@ -401,36 +407,37 @@ public class LlamaContext {
|
|
401
407
|
|
402
408
|
// TODO: Add runtime check for cpu features
|
403
409
|
if (LlamaContext.isArm64V8a()) {
|
404
|
-
if (
|
405
|
-
Log.d(NAME, "Loading
|
406
|
-
System.loadLibrary("
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
} else if (
|
417
|
-
Log.d(NAME, "Loading
|
418
|
-
System.loadLibrary("
|
419
|
-
|
420
|
-
Log.d(NAME, "Loading librnllama_v8_2_fp16.so");
|
421
|
-
System.loadLibrary("rnllama_v8_2_fp16");
|
410
|
+
if (hasDotProd && hasI8mm) {
|
411
|
+
Log.d(NAME, "Loading librnllama_v8_2_dotprod_i8mm.so");
|
412
|
+
System.loadLibrary("rnllama_v8_2_dotprod_i8mm");
|
413
|
+
loadedLibrary = "rnllama_v8_2_dotprod_i8mm";
|
414
|
+
} else if (hasDotProd) {
|
415
|
+
Log.d(NAME, "Loading librnllama_v8_2_dotprod.so");
|
416
|
+
System.loadLibrary("rnllama_v8_2_dotprod");
|
417
|
+
loadedLibrary = "rnllama_v8_2_dotprod";
|
418
|
+
} else if (hasI8mm) {
|
419
|
+
Log.d(NAME, "Loading librnllama_v8_2_i8mm.so");
|
420
|
+
System.loadLibrary("rnllama_v8_2_i8mm");
|
421
|
+
loadedLibrary = "rnllama_v8_2_i8mm";
|
422
|
+
} else if (hasFp16) {
|
423
|
+
Log.d(NAME, "Loading librnllama_v8_2.so");
|
424
|
+
System.loadLibrary("rnllama_v8_2");
|
425
|
+
loadedLibrary = "rnllama_v8_2";
|
422
426
|
} else {
|
423
|
-
Log.d(NAME, "Loading librnllama_v8.so");
|
427
|
+
Log.d(NAME, "Loading default librnllama_v8.so");
|
424
428
|
System.loadLibrary("rnllama_v8");
|
429
|
+
loadedLibrary = "rnllama_v8";
|
425
430
|
}
|
426
431
|
// Log.d(NAME, "Loading librnllama_v8_7.so with runtime feature detection");
|
427
432
|
// System.loadLibrary("rnllama_v8_7");
|
428
433
|
} else if (LlamaContext.isX86_64()) {
|
429
434
|
Log.d(NAME, "Loading librnllama_x86_64.so");
|
430
435
|
System.loadLibrary("rnllama_x86_64");
|
436
|
+
loadedLibrary = "rnllama_x86_64";
|
431
437
|
} else {
|
432
438
|
Log.d(NAME, "Loading default librnllama.so");
|
433
439
|
System.loadLibrary("rnllama");
|
440
|
+
loadedLibrary = "rnllama";
|
434
441
|
}
|
435
442
|
}
|
436
443
|
|
@@ -465,7 +472,7 @@ public class LlamaContext {
|
|
465
472
|
public void emitModelProgressUpdate(int progress) {
|
466
473
|
WritableMap event = Arguments.createMap();
|
467
474
|
event.putInt("progress", progress);
|
468
|
-
eventEmitter.emit("@
|
475
|
+
eventEmitter.emit("@RNLlama_onInitContextProgress", event);
|
469
476
|
}
|
470
477
|
|
471
478
|
protected static native WritableMap modelInfo(
|
@@ -35,7 +35,7 @@ public class RNLlama implements LifecycleEventListener {
|
|
35
35
|
|
36
36
|
private HashMap<Integer, LlamaContext> contexts = new HashMap<>();
|
37
37
|
|
38
|
-
private int llamaContextLimit = 1;
|
38
|
+
private int llamaContextLimit = -1;
|
39
39
|
|
40
40
|
public void setContextLimit(double limit, Promise promise) {
|
41
41
|
llamaContextLimit = (int) limit;
|
@@ -83,6 +83,9 @@ public class RNLlama implements LifecycleEventListener {
|
|
83
83
|
if (context != null) {
|
84
84
|
throw new Exception("Context already exists");
|
85
85
|
}
|
86
|
+
if (llamaContextLimit > -1 && contexts.size() >= llamaContextLimit) {
|
87
|
+
throw new Exception("Context limit reached");
|
88
|
+
}
|
86
89
|
LlamaContext llamaContext = new LlamaContext(contextId, reactContext, params);
|
87
90
|
if (llamaContext.getContext() == 0) {
|
88
91
|
throw new Exception("Failed to initialize context");
|
@@ -92,6 +95,7 @@ public class RNLlama implements LifecycleEventListener {
|
|
92
95
|
result.putBoolean("gpu", false);
|
93
96
|
result.putString("reasonNoGPU", "Currently not supported");
|
94
97
|
result.putMap("model", llamaContext.getModelDetails());
|
98
|
+
result.putString("androidLib", llamaContext.getLoadedLibrary());
|
95
99
|
return result;
|
96
100
|
} catch (Exception e) {
|
97
101
|
exception = e;
|
package/android/src/main/jni.cpp
CHANGED
@@ -11,9 +11,8 @@
|
|
11
11
|
#include <unordered_map>
|
12
12
|
#include "llama.h"
|
13
13
|
#include "llama-impl.h"
|
14
|
-
#include "
|
15
|
-
#include "
|
16
|
-
#include "rn-llama.hpp"
|
14
|
+
#include "ggml.h"
|
15
|
+
#include "rn-llama.h"
|
17
16
|
#include "jni-utils.h"
|
18
17
|
|
19
18
|
#define UNUSED(x) (void)(x)
|
@@ -345,10 +344,10 @@ Java_com_rnllama_LlamaContext_initContext(
|
|
345
344
|
llama_free(llama->ctx);
|
346
345
|
}
|
347
346
|
|
348
|
-
std::vector<
|
347
|
+
std::vector<common_adapter_lora_info> lora;
|
349
348
|
const char *lora_chars = env->GetStringUTFChars(lora_str, nullptr);
|
350
349
|
if (lora_chars != nullptr && lora_chars[0] != '\0') {
|
351
|
-
|
350
|
+
common_adapter_lora_info la;
|
352
351
|
la.path = lora_chars;
|
353
352
|
la.scale = lora_scaled;
|
354
353
|
lora.push_back(la);
|
@@ -362,7 +361,7 @@ Java_com_rnllama_LlamaContext_initContext(
|
|
362
361
|
jstring path = readablemap::getString(env, lora_adapter, "path", nullptr);
|
363
362
|
if (path != nullptr) {
|
364
363
|
const char *path_chars = env->GetStringUTFChars(path, nullptr);
|
365
|
-
|
364
|
+
common_adapter_lora_info la;
|
366
365
|
la.path = path_chars;
|
367
366
|
la.scale = readablemap::getFloat(env, lora_adapter, "scaled", 1.0f);
|
368
367
|
lora.push_back(la);
|
@@ -409,7 +408,7 @@ Java_com_rnllama_LlamaContext_loadModelDetails(
|
|
409
408
|
for (int i = 0; i < count; i++) {
|
410
409
|
char key[256];
|
411
410
|
llama_model_meta_key_by_index(llama->model, i, key, sizeof(key));
|
412
|
-
char val[
|
411
|
+
char val[4096];
|
413
412
|
llama_model_meta_val_str_by_index(llama->model, i, val, sizeof(val));
|
414
413
|
|
415
414
|
putString(env, meta, key, val);
|
@@ -421,6 +420,7 @@ Java_com_rnllama_LlamaContext_loadModelDetails(
|
|
421
420
|
llama_model_desc(llama->model, desc, sizeof(desc));
|
422
421
|
putString(env, result, "desc", desc);
|
423
422
|
putDouble(env, result, "size", llama_model_size(llama->model));
|
423
|
+
putDouble(env, result, "nEmbd", llama_model_n_embd(llama->model));
|
424
424
|
putDouble(env, result, "nParams", llama_model_n_params(llama->model));
|
425
425
|
putBoolean(env, result, "isChatTemplateSupported", llama->validateModelChatTemplate());
|
426
426
|
putMap(env, result, "metadata", meta);
|
@@ -621,9 +621,12 @@ Java_com_rnllama_LlamaContext_doCompletion(
|
|
621
621
|
sparams.dry_allowed_length = dry_allowed_length;
|
622
622
|
sparams.dry_penalty_last_n = dry_penalty_last_n;
|
623
623
|
|
624
|
+
const llama_model * model = llama_get_model(llama->ctx);
|
625
|
+
const llama_vocab * vocab = llama_model_get_vocab(model);
|
626
|
+
|
624
627
|
sparams.logit_bias.clear();
|
625
628
|
if (ignore_eos) {
|
626
|
-
sparams.logit_bias[
|
629
|
+
sparams.logit_bias[llama_vocab_eos(vocab)].bias = -INFINITY;
|
627
630
|
}
|
628
631
|
|
629
632
|
// dry break seq
|
@@ -642,7 +645,7 @@ Java_com_rnllama_LlamaContext_doCompletion(
|
|
642
645
|
sparams.dry_sequence_breakers = dry_sequence_breakers_vector;
|
643
646
|
|
644
647
|
// logit bias
|
645
|
-
const int n_vocab =
|
648
|
+
const int n_vocab = llama_vocab_n_tokens(vocab);
|
646
649
|
jsize logit_bias_len = env->GetArrayLength(logit_bias);
|
647
650
|
|
648
651
|
for (jsize i = 0; i < logit_bias_len; i++) {
|
@@ -921,7 +924,7 @@ Java_com_rnllama_LlamaContext_applyLoraAdapters(
|
|
921
924
|
auto llama = context_map[(long) context_ptr];
|
922
925
|
|
923
926
|
// lora_adapters: ReadableArray<ReadableMap>
|
924
|
-
std::vector<
|
927
|
+
std::vector<common_adapter_lora_info> lora_adapters;
|
925
928
|
int lora_adapters_size = readablearray::size(env, loraAdapters);
|
926
929
|
for (int i = 0; i < lora_adapters_size; i++) {
|
927
930
|
jobject lora_adapter = readablearray::getMap(env, loraAdapters, i);
|
@@ -930,7 +933,7 @@ Java_com_rnllama_LlamaContext_applyLoraAdapters(
|
|
930
933
|
const char *path_chars = env->GetStringUTFChars(path, nullptr);
|
931
934
|
env->ReleaseStringUTFChars(path, path_chars);
|
932
935
|
float scaled = readablemap::getFloat(env, lora_adapter, "scaled", 1.0f);
|
933
|
-
|
936
|
+
common_adapter_lora_info la;
|
934
937
|
la.path = path_chars;
|
935
938
|
la.scale = scaled;
|
936
939
|
lora_adapters.push_back(la);
|
@@ -955,7 +958,7 @@ Java_com_rnllama_LlamaContext_getLoadedLoraAdapters(
|
|
955
958
|
auto llama = context_map[(long) context_ptr];
|
956
959
|
auto loaded_lora_adapters = llama->getLoadedLoraAdapters();
|
957
960
|
auto result = createWritableArray(env);
|
958
|
-
for (
|
961
|
+
for (common_adapter_lora_info &la : loaded_lora_adapters) {
|
959
962
|
auto map = createWriteableMap(env);
|
960
963
|
putString(env, map, "path", la.path.c_str());
|
961
964
|
putDouble(env, map, "scaled", la.scale);
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/cpp/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
# Note
|
2
2
|
|
3
|
-
- Only `rn-llama.
|
3
|
+
- Only `rn-llama.h` and `rn-llama.cpp` are the specific files for this folder, others are sync from [llama.cpp](https://github.com/ggerganov/llama.cpp).
|
4
4
|
- We can update the native source by using the [bootstrap](../scripts/bootstrap.sh) script.
|