Skip to content

Commit f65df7e

Browse files
committed
common : remove llama_token_to_piece for compatibility with hack
Signed-off-by: Jared Van Bortel <[email protected]>
1 parent d17540b commit f65df7e

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

common/common.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,20 +1415,6 @@ std::vector<llama_token> llama_tokenize(
14151415
return result;
14161416
}
14171417

1418-
std::string llama_token_to_piece(const struct llama_context * ctx, llama_token token) {
1419-
std::vector<char> result(8, 0);
1420-
const int n_tokens = llama_token_to_piece(llama_get_model(ctx), token, result.data(), result.size());
1421-
if (n_tokens < 0) {
1422-
result.resize(-n_tokens);
1423-
int check = llama_token_to_piece(llama_get_model(ctx), token, result.data(), result.size());
1424-
GGML_ASSERT(check == -n_tokens);
1425-
} else {
1426-
result.resize(n_tokens);
1427-
}
1428-
1429-
return std::string(result.data(), result.size());
1430-
}
1431-
14321418
std::string llama_detokenize_spm(llama_context * ctx, const std::vector<llama_token> & tokens) {
14331419
const llama_token bos_id = llama_token_bos(llama_get_model(ctx));
14341420

common/common.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,6 @@ std::vector<llama_token> llama_tokenize(
211211
bool add_bos,
212212
bool special = false);
213213

214-
// tokenizes a token into a piece
215-
// should work similar to Python's `tokenizer.id_to_piece`
216-
std::string llama_token_to_piece(
217-
const struct llama_context * ctx,
218-
llama_token token);
219-
220214
// TODO: these should be moved in llama.h C-style API under single `llama_detokenize` function
221215
// that takes into account the tokenizer type and decides how to handle the leading space
222216
//

0 commit comments

Comments
 (0)