fix decoding error. adds errors=ignore parameter

This commit is contained in:
xaedes 2023-04-14 14:40:06 +02:00
parent bc9e84daca
commit 5f6b715071
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

View file

@ -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()