diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/common.cpp | 32 | ||||
-rw-r--r-- | common/common.h | 9 |
2 files changed, 0 insertions, 41 deletions
diff --git a/common/common.cpp b/common/common.cpp index 88a962ae..53002ba3 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -744,35 +744,3 @@ std::string llama_token_to_str(const struct llama_context * ctx, llama_token tok return std::string(result.data(), result.size()); } - -std::vector<llama_token> llama_tokenize_bpe( - struct llama_context * ctx, - const std::string & text, - bool add_bos) { - int n_tokens = text.length() + add_bos; - std::vector<llama_token> result(n_tokens); - n_tokens = llama_tokenize_bpe(ctx, text.c_str(), result.data(), result.size(), add_bos); - if (n_tokens < 0) { - result.resize(-n_tokens); - int check = llama_tokenize_bpe(ctx, text.c_str(), result.data(), result.size(), add_bos); - GGML_ASSERT(check == -n_tokens); - } else { - result.resize(n_tokens); - } - return result; -} - -std::string llama_token_to_str_bpe(const struct llama_context * ctx, llama_token token) { - std::vector<char> result(8, 0); - const int n_tokens = llama_token_to_str_bpe(ctx, token, result.data(), result.size()); - if (n_tokens < 0) { - result.resize(-n_tokens); - const int check = llama_token_to_str_bpe(ctx, token, result.data(), result.size()); - GGML_ASSERT(check == -n_tokens); - } else { - result.resize(n_tokens); - } - - return std::string(result.data(), result.size()); -} - diff --git a/common/common.h b/common/common.h index d68a8ef8..17d271e6 100644 --- a/common/common.h +++ b/common/common.h @@ -120,15 +120,6 @@ std::vector<llama_token> llama_tokenize( const std::string & text, bool add_bos); -std::vector<llama_token> llama_tokenize_bpe( - struct llama_context * ctx, - const std::string & text, - bool add_bos); - std::string llama_token_to_str( const struct llama_context * ctx, llama_token token); - -std::string llama_token_to_str_bpe( - const struct llama_context * ctx, - llama_token token); |