| llama_detokenize | R Documentation |
Detokenize token IDs back to text
llama_detokenize(ctx, tokens)
ctx |
Context handle returned by [llama_new_context] |
tokens |
Integer vector of token IDs (as returned by [llama_tokenize]) |
A character scalar containing the decoded text.
## Not run:
model <- llama_load_model("model.gguf")
ctx <- llama_new_context(model)
# Round-trip: text -> tokens -> text
original <- "Hello, world!"
tokens <- llama_tokenize(ctx, original, add_special = FALSE)
restored <- llama_detokenize(ctx, tokens)
identical(original, restored) # TRUE
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.