MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llama_token_to_piece

Function llama_token_to_piece

llama.cpp:1198–1211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1196}
1197
1198static std::string llama_token_to_piece(const struct llama_context * ctx, llama_token token) {
1199 std::vector<char> result(8, 0);
1200 const int n_tokens = llama_token_to_piece(llama_get_model(ctx), token, result.data(), result.size());
1201 if (n_tokens < 0) {
1202 result.resize(-n_tokens);
1203 int check = llama_token_to_piece(llama_get_model(ctx), token, result.data(), result.size());
1204 GGML_ASSERT(check == -n_tokens);
1205 }
1206 else {
1207 result.resize(n_tokens);
1208 }
1209
1210 return std::string(result.data(), result.size());
1211}
1212
1213//
1214// globals

Callers 15

llama_sample_grammarFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
sampleFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
beam-search.cppFile · 0.50
mainFunction · 0.50
tokens_to_strFunction · 0.50

Calls 15

llama_vocab_get_typeFunction · 0.85
llama_is_normal_tokenFunction · 0.85
llama_is_unknown_tokenFunction · 0.85
llama_is_control_tokenFunction · 0.85
llama_is_byte_tokenFunction · 0.85
llama_token_to_byteFunction · 0.85
lengthMethod · 0.80
llama_get_modelFunction · 0.70
llama_n_vocabFunction · 0.70
llama_decode_textFunction · 0.70
stringFunction · 0.50

Tested by 1

mainFunction · 0.40