cui-llama.rn 1.2.0 → 1.2.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 +2 -0
- package/android/src/main/CMakeLists.txt +2 -2
- package/android/src/main/java/com/rnllama/LlamaContext.java +31 -9
- package/android/src/main/java/com/rnllama/RNLlama.java +39 -0
- package/android/src/newarch/java/com/rnllama/RNLlamaModule.java +5 -0
- package/android/src/oldarch/java/com/rnllama/RNLlamaModule.java +5 -0
- package/cpp/common.cpp +36 -1
- package/cpp/common.h +5 -1
- package/cpp/ggml-aarch64.c +2 -11
- package/cpp/ggml-alloc.h +1 -1
- package/cpp/ggml-backend-impl.h +151 -78
- package/cpp/{ggml-backend.c → ggml-backend.cpp} +565 -269
- package/cpp/ggml-backend.h +147 -62
- package/cpp/ggml-impl.h +15 -0
- package/cpp/ggml-metal.h +8 -9
- package/cpp/ggml-metal.m +2428 -2111
- package/cpp/ggml-quants.c +2 -2
- package/cpp/ggml-quants.h +0 -4
- package/cpp/ggml.c +799 -1121
- package/cpp/ggml.h +79 -72
- package/cpp/llama-vocab.cpp +189 -106
- package/cpp/llama-vocab.h +18 -9
- package/cpp/llama.cpp +736 -341
- package/cpp/llama.h +9 -4
- package/cpp/unicode-data.cpp +6 -4
- package/cpp/unicode-data.h +4 -4
- package/cpp/unicode.cpp +14 -7
- package/lib/commonjs/NativeRNLlama.js.map +1 -1
- package/lib/commonjs/index.js +4 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeRNLlama.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/NativeRNLlama.d.ts +6 -0
- package/lib/typescript/NativeRNLlama.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeRNLlama.ts +7 -0
- package/src/index.ts +5 -0
package/cpp/llama-vocab.h
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
#include <map>
|
9
9
|
#include <set>
|
10
10
|
|
11
|
+
struct llm_tokenizer;
|
12
|
+
|
11
13
|
struct llama_vocab {
|
12
14
|
using id = llama_token;
|
13
15
|
using token = std::string;
|
@@ -38,17 +40,17 @@ struct llama_vocab {
|
|
38
40
|
id special_bos_id = 1;
|
39
41
|
id special_eos_id = 2;
|
40
42
|
id special_unk_id = 0;
|
41
|
-
id special_sep_id =
|
42
|
-
id special_pad_id =
|
43
|
-
id special_cls_id =
|
44
|
-
id special_mask_id =
|
43
|
+
id special_sep_id = LLAMA_TOKEN_NULL;
|
44
|
+
id special_pad_id = LLAMA_TOKEN_NULL;
|
45
|
+
id special_cls_id = LLAMA_TOKEN_NULL;
|
46
|
+
id special_mask_id = LLAMA_TOKEN_NULL;
|
45
47
|
|
46
48
|
id linefeed_id = 13;
|
47
|
-
id special_prefix_id =
|
48
|
-
id special_suffix_id =
|
49
|
-
id special_middle_id =
|
50
|
-
id special_eot_id =
|
51
|
-
id special_eom_id =
|
49
|
+
id special_prefix_id = LLAMA_TOKEN_NULL;
|
50
|
+
id special_suffix_id = LLAMA_TOKEN_NULL;
|
51
|
+
id special_middle_id = LLAMA_TOKEN_NULL;
|
52
|
+
id special_eot_id = LLAMA_TOKEN_NULL; // TODO: move above after "eos_id", and here add "file separator" token
|
53
|
+
id special_eom_id = LLAMA_TOKEN_NULL;
|
52
54
|
|
53
55
|
// set of all tokens that cause "end of generation"
|
54
56
|
std::set<id> special_eog_ids;
|
@@ -65,7 +67,14 @@ struct llama_vocab {
|
|
65
67
|
|
66
68
|
std::vector<char> precompiled_charsmap;
|
67
69
|
|
70
|
+
llm_tokenizer * tokenizer = nullptr;
|
71
|
+
|
72
|
+
llama_vocab() = default;
|
73
|
+
~llama_vocab();
|
74
|
+
|
68
75
|
int find_bpe_rank(const std::string & token_left, const std::string & token_right) const;
|
76
|
+
|
77
|
+
void init_tokenizer();
|
69
78
|
};
|
70
79
|
|
71
80
|
//
|