@fugood/llama.node 0.3.6 → 0.3.8
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 +17 -2
- package/bin/darwin/arm64/llama-node.node +0 -0
- package/bin/darwin/x64/llama-node.node +0 -0
- package/bin/linux/arm64/llama-node.node +0 -0
- package/bin/linux/x64/llama-node.node +0 -0
- package/bin/linux-cuda/arm64/llama-node.node +0 -0
- package/bin/linux-cuda/x64/llama-node.node +0 -0
- package/bin/linux-vulkan/arm64/llama-node.node +0 -0
- package/bin/linux-vulkan/x64/llama-node.node +0 -0
- package/bin/win32/arm64/llama-node.node +0 -0
- package/bin/win32/arm64/node.lib +0 -0
- package/bin/win32/x64/llama-node.node +0 -0
- package/bin/win32/x64/node.lib +0 -0
- package/bin/win32-vulkan/arm64/llama-node.node +0 -0
- package/bin/win32-vulkan/arm64/node.lib +0 -0
- package/bin/win32-vulkan/x64/llama-node.node +0 -0
- package/bin/win32-vulkan/x64/node.lib +0 -0
- package/lib/binding.ts +3 -1
- package/lib/index.js +16 -1
- package/lib/index.ts +16 -0
- package/package.json +1 -1
- package/src/EmbeddingWorker.cpp +4 -3
- package/src/LlamaCompletionWorker.cpp +4 -2
- package/src/LlamaContext.cpp +61 -6
- package/src/LlamaContext.h +1 -0
- package/src/common.hpp +6 -11
- package/src/llama.cpp/.github/workflows/build.yml +19 -17
- package/src/llama.cpp/.github/workflows/docker.yml +77 -30
- package/src/llama.cpp/.github/workflows/editorconfig.yml +3 -1
- package/src/llama.cpp/.github/workflows/server.yml +22 -3
- package/src/llama.cpp/CMakeLists.txt +49 -24
- package/src/llama.cpp/common/arg.cpp +82 -26
- package/src/llama.cpp/common/arg.h +3 -0
- package/src/llama.cpp/common/common.cpp +192 -72
- package/src/llama.cpp/common/common.h +51 -18
- package/src/llama.cpp/common/ngram-cache.cpp +12 -12
- package/src/llama.cpp/common/ngram-cache.h +2 -2
- package/src/llama.cpp/common/sampling.cpp +11 -6
- package/src/llama.cpp/common/speculative.cpp +18 -15
- package/src/llama.cpp/docs/build.md +2 -0
- package/src/llama.cpp/examples/batched/batched.cpp +9 -7
- package/src/llama.cpp/examples/batched-bench/batched-bench.cpp +3 -3
- package/src/llama.cpp/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp +10 -8
- package/src/llama.cpp/examples/cvector-generator/cvector-generator.cpp +11 -8
- package/src/llama.cpp/examples/cvector-generator/mean.hpp +1 -1
- package/src/llama.cpp/examples/cvector-generator/pca.hpp +1 -1
- package/src/llama.cpp/examples/embedding/embedding.cpp +8 -7
- package/src/llama.cpp/examples/eval-callback/eval-callback.cpp +7 -6
- package/src/llama.cpp/examples/export-lora/export-lora.cpp +8 -7
- package/src/llama.cpp/examples/gguf/gguf.cpp +10 -6
- package/src/llama.cpp/examples/gguf-hash/gguf-hash.cpp +1 -0
- package/src/llama.cpp/examples/gguf-split/gguf-split.cpp +8 -7
- package/src/llama.cpp/examples/gritlm/gritlm.cpp +13 -10
- package/src/llama.cpp/examples/imatrix/imatrix.cpp +13 -12
- package/src/llama.cpp/examples/infill/infill.cpp +23 -24
- package/src/llama.cpp/examples/llama-bench/llama-bench.cpp +44 -13
- package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/llama-android.cpp +11 -6
- package/src/llama.cpp/examples/llava/clip.cpp +4 -2
- package/src/llama.cpp/examples/llava/llava-cli.cpp +9 -6
- package/src/llama.cpp/examples/llava/llava.cpp +2 -2
- package/src/llama.cpp/examples/llava/minicpmv-cli.cpp +8 -4
- package/src/llama.cpp/examples/llava/qwen2vl-cli.cpp +11 -8
- package/src/llama.cpp/examples/lookahead/lookahead.cpp +6 -7
- package/src/llama.cpp/examples/lookup/lookup-create.cpp +4 -9
- package/src/llama.cpp/examples/lookup/lookup-stats.cpp +3 -7
- package/src/llama.cpp/examples/lookup/lookup.cpp +5 -6
- package/src/llama.cpp/examples/main/main.cpp +51 -29
- package/src/llama.cpp/examples/parallel/parallel.cpp +5 -6
- package/src/llama.cpp/examples/passkey/passkey.cpp +7 -5
- package/src/llama.cpp/examples/perplexity/perplexity.cpp +37 -23
- package/src/llama.cpp/examples/quantize-stats/quantize-stats.cpp +12 -14
- package/src/llama.cpp/examples/retrieval/retrieval.cpp +8 -8
- package/src/llama.cpp/examples/rpc/rpc-server.cpp +12 -0
- package/src/llama.cpp/examples/run/CMakeLists.txt +1 -1
- package/src/llama.cpp/examples/run/linenoise.cpp/linenoise.cpp +1351 -0
- package/src/llama.cpp/examples/run/linenoise.cpp/linenoise.h +114 -0
- package/src/llama.cpp/examples/run/run.cpp +175 -61
- package/src/llama.cpp/examples/save-load-state/save-load-state.cpp +4 -25
- package/src/llama.cpp/examples/server/CMakeLists.txt +1 -0
- package/src/llama.cpp/examples/server/httplib.h +1295 -409
- package/src/llama.cpp/examples/server/server.cpp +387 -181
- package/src/llama.cpp/examples/server/tests/requirements.txt +1 -0
- package/src/llama.cpp/examples/server/utils.hpp +170 -58
- package/src/llama.cpp/examples/simple/simple.cpp +9 -8
- package/src/llama.cpp/examples/simple-chat/simple-chat.cpp +16 -12
- package/src/llama.cpp/examples/speculative/speculative.cpp +22 -23
- package/src/llama.cpp/examples/speculative-simple/speculative-simple.cpp +8 -12
- package/src/llama.cpp/examples/tokenize/tokenize.cpp +17 -5
- package/src/llama.cpp/examples/tts/tts.cpp +64 -23
- package/src/llama.cpp/ggml/CMakeLists.txt +5 -21
- package/src/llama.cpp/ggml/include/ggml-backend.h +2 -0
- package/src/llama.cpp/ggml/include/ggml-cpp.h +1 -0
- package/src/llama.cpp/ggml/include/ggml.h +36 -145
- package/src/llama.cpp/ggml/include/gguf.h +202 -0
- package/src/llama.cpp/ggml/src/CMakeLists.txt +6 -3
- package/src/llama.cpp/ggml/src/ggml-alloc.c +5 -0
- package/src/llama.cpp/ggml/src/ggml-backend-impl.h +0 -1
- package/src/llama.cpp/ggml/src/ggml-backend-reg.cpp +79 -49
- package/src/llama.cpp/ggml/src/ggml-backend.cpp +5 -2
- package/src/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt +33 -23
- package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp +57 -72
- package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c +87 -2
- package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c +335 -66
- package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp +10 -2
- package/src/llama.cpp/ggml/src/ggml-cpu/llamafile/sgemm.cpp +1090 -378
- package/src/llama.cpp/ggml/src/ggml-cpu/llamafile/sgemm.h +2 -2
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/cuda.h +1 -0
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/hip.h +3 -0
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/musa.h +3 -0
- package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +3 -1
- package/src/llama.cpp/ggml/src/ggml-impl.h +11 -16
- package/src/llama.cpp/ggml/src/ggml-metal/CMakeLists.txt +16 -0
- package/src/llama.cpp/ggml/src/ggml-opencl/ggml-opencl.cpp +6 -6
- package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +154 -35
- package/src/llama.cpp/ggml/src/ggml-sycl/backend.hpp +1 -0
- package/src/llama.cpp/ggml/src/ggml-sycl/common.cpp +9 -3
- package/src/llama.cpp/ggml/src/ggml-sycl/common.hpp +18 -0
- package/src/llama.cpp/ggml/src/ggml-sycl/concat.cpp +3 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/concat.hpp +1 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/conv.cpp +3 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/conv.hpp +1 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/dpct/helper.hpp +40 -95
- package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.cpp +48 -48
- package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.hpp +24 -24
- package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +238 -164
- package/src/llama.cpp/ggml/src/ggml-sycl/gla.cpp +105 -0
- package/src/llama.cpp/ggml/src/ggml-sycl/gla.hpp +8 -0
- package/src/llama.cpp/ggml/src/ggml-sycl/outprod.cpp +3 -3
- package/src/llama.cpp/ggml/src/ggml-sycl/outprod.hpp +1 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.cpp +3 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.hpp +1 -2
- package/src/llama.cpp/ggml/src/ggml-sycl/wkv6.cpp +7 -5
- package/src/llama.cpp/ggml/src/ggml-sycl/wkv6.hpp +1 -2
- package/src/llama.cpp/ggml/src/ggml-vulkan/CMakeLists.txt +74 -4
- package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +314 -116
- package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +4 -2
- package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +9 -3
- package/src/llama.cpp/ggml/src/ggml.c +117 -1327
- package/src/llama.cpp/ggml/src/gguf.cpp +1329 -0
- package/src/llama.cpp/include/llama-cpp.h +6 -1
- package/src/llama.cpp/include/llama.h +138 -75
- package/src/llama.cpp/src/CMakeLists.txt +13 -1
- package/src/llama.cpp/src/llama-adapter.cpp +347 -0
- package/src/llama.cpp/src/llama-adapter.h +74 -0
- package/src/llama.cpp/src/llama-arch.cpp +1487 -0
- package/src/llama.cpp/src/llama-arch.h +400 -0
- package/src/llama.cpp/src/llama-batch.cpp +368 -0
- package/src/llama.cpp/src/llama-batch.h +88 -0
- package/src/llama.cpp/src/llama-chat.cpp +578 -0
- package/src/llama.cpp/src/llama-chat.h +52 -0
- package/src/llama.cpp/src/llama-context.cpp +1775 -0
- package/src/llama.cpp/src/llama-context.h +128 -0
- package/src/llama.cpp/src/llama-cparams.cpp +1 -0
- package/src/llama.cpp/src/llama-cparams.h +37 -0
- package/src/llama.cpp/src/llama-grammar.cpp +5 -4
- package/src/llama.cpp/src/llama-grammar.h +3 -1
- package/src/llama.cpp/src/llama-hparams.cpp +71 -0
- package/src/llama.cpp/src/llama-hparams.h +139 -0
- package/src/llama.cpp/src/llama-impl.cpp +167 -0
- package/src/llama.cpp/src/llama-impl.h +16 -136
- package/src/llama.cpp/src/llama-kv-cache.cpp +718 -0
- package/src/llama.cpp/src/llama-kv-cache.h +218 -0
- package/src/llama.cpp/src/llama-mmap.cpp +589 -0
- package/src/llama.cpp/src/llama-mmap.h +67 -0
- package/src/llama.cpp/src/llama-model-loader.cpp +1124 -0
- package/src/llama.cpp/src/llama-model-loader.h +167 -0
- package/src/llama.cpp/src/llama-model.cpp +3953 -0
- package/src/llama.cpp/src/llama-model.h +370 -0
- package/src/llama.cpp/src/llama-quant.cpp +934 -0
- package/src/llama.cpp/src/llama-quant.h +1 -0
- package/src/llama.cpp/src/llama-sampling.cpp +147 -32
- package/src/llama.cpp/src/llama-sampling.h +3 -19
- package/src/llama.cpp/src/llama-vocab.cpp +1832 -575
- package/src/llama.cpp/src/llama-vocab.h +97 -142
- package/src/llama.cpp/src/llama.cpp +7160 -20314
- package/src/llama.cpp/src/unicode.cpp +8 -3
- package/src/llama.cpp/tests/CMakeLists.txt +2 -0
- package/src/llama.cpp/tests/test-autorelease.cpp +3 -3
- package/src/llama.cpp/tests/test-backend-ops.cpp +370 -59
- package/src/llama.cpp/tests/test-chat-template.cpp +162 -125
- package/src/llama.cpp/tests/test-gguf.cpp +222 -187
- package/src/llama.cpp/tests/test-model-load-cancel.cpp +1 -1
- package/src/llama.cpp/tests/test-sampling.cpp +0 -1
- package/src/llama.cpp/tests/test-tokenizer-0.cpp +4 -4
- package/src/llama.cpp/tests/test-tokenizer-1-bpe.cpp +9 -7
- package/src/llama.cpp/tests/test-tokenizer-1-spm.cpp +8 -6
|
@@ -1,170 +1,125 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include "llama
|
|
3
|
+
#include "llama.h"
|
|
4
4
|
|
|
5
5
|
#include <string>
|
|
6
6
|
#include <vector>
|
|
7
|
-
#include <
|
|
8
|
-
#include <map>
|
|
9
|
-
#include <set>
|
|
7
|
+
#include <memory>
|
|
10
8
|
|
|
11
|
-
struct
|
|
9
|
+
struct LLM_KV;
|
|
10
|
+
struct llama_model_loader;
|
|
12
11
|
|
|
13
12
|
struct llama_vocab {
|
|
14
|
-
using id = llama_token;
|
|
15
|
-
using token = std::string;
|
|
16
|
-
using tattr = llama_token_attr;
|
|
17
|
-
|
|
18
13
|
struct token_data {
|
|
19
|
-
|
|
20
|
-
float
|
|
21
|
-
|
|
14
|
+
std::string text;
|
|
15
|
+
float score;
|
|
16
|
+
llama_token_attr attr;
|
|
22
17
|
};
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
llama_vocab();
|
|
20
|
+
~llama_vocab();
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
enum llama_vocab_pre_type type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
|
22
|
+
void load(llama_model_loader & ml, const LLM_KV & kv);
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
enum llama_vocab_type get_type() const;
|
|
25
|
+
enum llama_vocab_pre_type get_pre_type() const;
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
uint32_t n_tokens() const;
|
|
28
|
+
uint32_t n_token_types() const;
|
|
33
29
|
|
|
34
|
-
std::
|
|
35
|
-
std::vector<token> cache_token_to_piece; // llama_token_to_piece(special = true);
|
|
30
|
+
std::string type_name() const;
|
|
36
31
|
|
|
37
|
-
|
|
32
|
+
bool is_normal (llama_token id) const;
|
|
33
|
+
bool is_unknown (llama_token id) const;
|
|
34
|
+
bool is_control (llama_token id) const;
|
|
35
|
+
bool is_byte (llama_token id) const;
|
|
36
|
+
bool is_user_defined(llama_token id) const;
|
|
37
|
+
bool is_unused (llama_token id) const;
|
|
38
|
+
bool is_eog (llama_token id) const;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
id special_bos_id = 1;
|
|
42
|
-
id special_eos_id = 2;
|
|
43
|
-
id special_eot_id = LLAMA_TOKEN_NULL;
|
|
44
|
-
id special_eom_id = LLAMA_TOKEN_NULL;
|
|
45
|
-
id special_unk_id = 0;
|
|
46
|
-
id special_sep_id = LLAMA_TOKEN_NULL;
|
|
47
|
-
id special_pad_id = LLAMA_TOKEN_NULL;
|
|
48
|
-
id special_cls_id = LLAMA_TOKEN_NULL;
|
|
49
|
-
id special_mask_id = LLAMA_TOKEN_NULL;
|
|
40
|
+
uint8_t token_to_byte(llama_token id) const;
|
|
41
|
+
llama_token byte_to_token(uint8_t ch) const;
|
|
50
42
|
|
|
51
|
-
|
|
43
|
+
llama_token text_to_token(const std::string & text) const;
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
id special_fim_pre_id = LLAMA_TOKEN_NULL;
|
|
55
|
-
id special_fim_suf_id = LLAMA_TOKEN_NULL;
|
|
56
|
-
id special_fim_mid_id = LLAMA_TOKEN_NULL;
|
|
57
|
-
id special_fim_pad_id = LLAMA_TOKEN_NULL;
|
|
58
|
-
id special_fim_rep_id = LLAMA_TOKEN_NULL; // repo
|
|
59
|
-
id special_fim_sep_id = LLAMA_TOKEN_NULL; // file separator
|
|
45
|
+
const token_data & get_token_data(llama_token id) const;
|
|
60
46
|
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
const char * token_get_text (llama_token id) const;
|
|
48
|
+
float token_get_score(llama_token id) const;
|
|
49
|
+
llama_token_attr token_get_attr (llama_token id) const;
|
|
63
50
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
bool tokenizer_treat_whitespace_as_suffix = false;
|
|
51
|
+
llama_token token_bos() const;
|
|
52
|
+
llama_token token_eos() const;
|
|
53
|
+
llama_token token_eot() const;
|
|
54
|
+
llama_token token_eom() const;
|
|
55
|
+
llama_token token_unk() const;
|
|
56
|
+
llama_token token_sep() const;
|
|
57
|
+
llama_token token_nl () const;
|
|
58
|
+
llama_token token_pad() const;
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
llama_token token_prefix() const;
|
|
61
|
+
llama_token token_middle() const;
|
|
62
|
+
llama_token token_suffix() const;
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
llama_token token_fim_pre() const;
|
|
65
|
+
llama_token token_fim_suf() const;
|
|
66
|
+
llama_token token_fim_mid() const;
|
|
67
|
+
llama_token token_fim_pad() const;
|
|
68
|
+
llama_token token_fim_rep() const;
|
|
69
|
+
llama_token token_fim_sep() const;
|
|
77
70
|
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
bool get_add_space_prefix () const;
|
|
72
|
+
bool get_add_bos () const;
|
|
73
|
+
bool get_add_eos () const;
|
|
74
|
+
bool get_ignore_merges () const;
|
|
75
|
+
bool get_clean_spaces () const;
|
|
76
|
+
bool get_remove_extra_whitespaces () const;
|
|
77
|
+
bool get_escape_whitespaces () const;
|
|
78
|
+
bool get_treat_whitespace_as_suffix() const;
|
|
79
|
+
|
|
80
|
+
int max_token_len() const;
|
|
80
81
|
|
|
81
82
|
int find_bpe_rank(const std::string & token_left, const std::string & token_right) const;
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
int32_t tokenize(
|
|
85
|
+
const char * text,
|
|
86
|
+
int32_t text_len,
|
|
87
|
+
llama_token * tokens,
|
|
88
|
+
int32_t n_tokens_max,
|
|
89
|
+
bool add_special,
|
|
90
|
+
bool parse_special) const;
|
|
91
|
+
|
|
92
|
+
std::vector<llama_token> tokenize(
|
|
93
|
+
const std::string & raw_text,
|
|
94
|
+
bool add_special,
|
|
95
|
+
bool parse_special = false) const;
|
|
96
|
+
|
|
97
|
+
// does not write null-terminator to buf
|
|
98
|
+
int32_t token_to_piece(
|
|
99
|
+
llama_token token,
|
|
100
|
+
char * buf,
|
|
101
|
+
int32_t length,
|
|
102
|
+
int32_t lstrip,
|
|
103
|
+
bool special) const;
|
|
104
|
+
|
|
105
|
+
// use cached data
|
|
106
|
+
const std::string & token_to_piece(llama_token token) const;
|
|
107
|
+
|
|
108
|
+
int32_t detokenize(
|
|
109
|
+
const llama_token * tokens,
|
|
110
|
+
int32_t n_tokens,
|
|
111
|
+
char * text,
|
|
112
|
+
int32_t text_len_max,
|
|
113
|
+
bool remove_special,
|
|
114
|
+
bool unparse_special) const;
|
|
115
|
+
|
|
116
|
+
std::string detokenize(
|
|
117
|
+
const std::vector<llama_token> & tokens,
|
|
118
|
+
bool special) const;
|
|
119
|
+
|
|
120
|
+
void print_info() const;
|
|
121
|
+
|
|
122
|
+
private:
|
|
123
|
+
struct impl;
|
|
124
|
+
std::unique_ptr<impl> pimpl;
|
|
84
125
|
};
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
// internal API
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
// TODO: rename to llama_tokenize_impl
|
|
91
|
-
// TODO: This should probably be in llama.h
|
|
92
|
-
std::vector<llama_vocab::id> llama_tokenize_internal(
|
|
93
|
-
const llama_vocab & vocab,
|
|
94
|
-
std::string raw_text,
|
|
95
|
-
bool add_special,
|
|
96
|
-
bool parse_special = false);
|
|
97
|
-
|
|
98
|
-
// TODO: move the API below as member functions of llama_vocab
|
|
99
|
-
llama_token llama_byte_to_token_impl(const llama_vocab & vocab, uint8_t ch);
|
|
100
|
-
|
|
101
|
-
const char * llama_token_get_text_impl(const struct llama_vocab & vocab, llama_token token);
|
|
102
|
-
|
|
103
|
-
float llama_token_get_score_impl(const struct llama_vocab & vocab, llama_token token);
|
|
104
|
-
|
|
105
|
-
llama_token_attr llama_token_get_attr_impl(const struct llama_vocab & vocab, llama_token token);
|
|
106
|
-
|
|
107
|
-
bool llama_token_is_eog_impl(const struct llama_vocab & vocab, llama_token token);
|
|
108
|
-
|
|
109
|
-
bool llama_token_is_control_impl(const struct llama_vocab & vocab, llama_token token);
|
|
110
|
-
|
|
111
|
-
llama_token llama_token_bos_impl(const struct llama_vocab & vocab);
|
|
112
|
-
llama_token llama_token_eos_impl(const struct llama_vocab & vocab);
|
|
113
|
-
llama_token llama_token_eot_impl(const struct llama_vocab & vocab);
|
|
114
|
-
llama_token llama_token_eom_impl(const struct llama_vocab & vocab);
|
|
115
|
-
llama_token llama_token_cls_impl(const struct llama_vocab & vocab);
|
|
116
|
-
llama_token llama_token_sep_impl(const struct llama_vocab & vocab);
|
|
117
|
-
llama_token llama_token_nl_impl (const struct llama_vocab & vocab);
|
|
118
|
-
llama_token llama_token_pad_impl(const struct llama_vocab & vocab);
|
|
119
|
-
|
|
120
|
-
llama_token llama_token_prefix_impl(const struct llama_vocab & vocab);
|
|
121
|
-
llama_token llama_token_middle_impl(const struct llama_vocab & vocab);
|
|
122
|
-
llama_token llama_token_suffix_impl(const struct llama_vocab & vocab);
|
|
123
|
-
|
|
124
|
-
llama_token llama_token_fim_pre_impl(const struct llama_vocab & vocab);
|
|
125
|
-
llama_token llama_token_fim_suf_impl(const struct llama_vocab & vocab);
|
|
126
|
-
llama_token llama_token_fim_mid_impl(const struct llama_vocab & vocab);
|
|
127
|
-
llama_token llama_token_fim_pad_impl(const struct llama_vocab & vocab);
|
|
128
|
-
llama_token llama_token_fim_rep_impl(const struct llama_vocab & vocab);
|
|
129
|
-
llama_token llama_token_fim_sep_impl(const struct llama_vocab & vocab);
|
|
130
|
-
|
|
131
|
-
bool llama_add_bos_token_impl(const struct llama_vocab & vocab);
|
|
132
|
-
bool llama_add_eos_token_impl(const struct llama_vocab & vocab);
|
|
133
|
-
|
|
134
|
-
int32_t llama_tokenize_impl(
|
|
135
|
-
const struct llama_vocab & vocab,
|
|
136
|
-
const char * text,
|
|
137
|
-
int32_t text_len,
|
|
138
|
-
llama_token * tokens,
|
|
139
|
-
int32_t n_tokens_max,
|
|
140
|
-
bool add_special,
|
|
141
|
-
bool parse_special);
|
|
142
|
-
|
|
143
|
-
// does not write null-terminator to buf
|
|
144
|
-
int32_t llama_token_to_piece_impl(
|
|
145
|
-
const struct llama_vocab & vocab,
|
|
146
|
-
llama_token token,
|
|
147
|
-
char * buf,
|
|
148
|
-
int32_t length,
|
|
149
|
-
int32_t lstrip,
|
|
150
|
-
bool special);
|
|
151
|
-
|
|
152
|
-
// check if token0 is contained as a prefix in token1
|
|
153
|
-
bool llama_token_is_prefix_impl(
|
|
154
|
-
const struct llama_vocab & vocab,
|
|
155
|
-
llama_token token0,
|
|
156
|
-
llama_token token1);
|
|
157
|
-
|
|
158
|
-
int32_t llama_detokenize_impl(
|
|
159
|
-
const struct llama_vocab & vocab,
|
|
160
|
-
const llama_token * tokens,
|
|
161
|
-
int32_t n_tokens,
|
|
162
|
-
char * text,
|
|
163
|
-
int32_t text_len_max,
|
|
164
|
-
bool remove_special,
|
|
165
|
-
bool unparse_special);
|
|
166
|
-
|
|
167
|
-
std::string llama_detokenize(
|
|
168
|
-
const struct llama_vocab & vocab,
|
|
169
|
-
const std::vector<llama_token> & tokens,
|
|
170
|
-
bool special);
|