diff --git a/py/llama_cpp/llama.py b/py/llama_cpp/llama.py index 39da58f17..a09c8425e 100644 --- a/py/llama_cpp/llama.py +++ b/py/llama_cpp/llama.py @@ -151,7 +151,7 @@ def llama_get_embeddings(ctx: llama_context_p): def llama_token_to_str(ctx: llama_context_p, token: int) -> str: """Token Id -> String. Uses the vocabulary in the provided context""" - return lib.llama_token_to_str(ctx, token).decode('utf-8') + return lib.llama_token_to_str(ctx, token).decode('utf-8', errors='ignore') def llama_token_bos() -> llama_token: return lib.llama_token_bos()