From 9c9df2063f61d19fa1755b2906ba6804f88c4e68 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:38:02 -0700 Subject: [PATCH] llama.cpp: fix unicode decoding (closes #6856) --- modules/llama_cpp_server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/llama_cpp_server.py b/modules/llama_cpp_server.py index faf6e20e..9c97e00b 100644 --- a/modules/llama_cpp_server.py +++ b/modules/llama_cpp_server.py @@ -152,7 +152,7 @@ class LlamaServer: full_text = "" # Process the streaming response - for line in response.iter_lines(decode_unicode=True): + for line in response.iter_lines(): if shared.stop_everything: break @@ -160,6 +160,8 @@ class LlamaServer: continue try: + line = line.decode('utf-8') + # Check if the line starts with "data: " and remove it if line.startswith('data: '): line = line[6:] # Remove the "data: " prefix