Skip to content

Commit 6314b51

Browse files
committed
common : add comments
1 parent 9668aa1 commit 6314b51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

common/common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,21 @@ struct llama_context_params llama_context_params_from_gpt_params(const gpt_param
116116
// Vocab utils
117117
//
118118

119+
// tokenizes a string into a vector of tokens
120+
// should work similar to Python's `tokenizer.decode`
119121
std::vector<llama_token> llama_tokenize(
120122
struct llama_context * ctx,
121123
const std::string & text,
122124
bool add_bos);
123125

126+
// tokenizes a token into a piece
127+
// should work similar to Python's `tokenizer.id_to_piece`
124128
std::string llama_token_to_piece(
125129
const struct llama_context * ctx,
126130
llama_token token);
127131

132+
// detokenizes a vector of tokens into a string
133+
// should work similar to Python's `tokenizer.decode`
128134
// removes the leading space from the first non-BOS token
129135
std::string llama_detokenize(
130136
llama_context * ctx,

0 commit comments

Comments
 (0)