diff --git a/unsloth/save.py b/unsloth/save.py index caa5aaa619..033f6eb1e0 100644 --- a/unsloth/save.py +++ b/unsloth/save.py @@ -777,9 +777,10 @@ def install_llama_cpp_old(version = -10): for command in commands: with subprocess.Popen(command, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, bufsize = 1) as sp: for line in sp.stdout: + line = line.decode("utf-8", errors = "replace") if "undefined reference" in line: raise RuntimeError("Failed compiling llama.cpp. Please report this ASAP!") - print(line.decode("utf-8", errors = "replace"), flush = True, end = "") + print(line, flush = True, end = "") pass pass # Check if successful @@ -811,9 +812,10 @@ def install_llama_cpp_blocking(use_cuda = True): for command in commands: with subprocess.Popen(command, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, bufsize = 1) as sp: for line in sp.stdout: + line = line.decode("utf-8", errors = "replace") if "undefined reference" in line: raise RuntimeError("Failed compiling llama.cpp. Please report this ASAP!") - print(line.decode("utf-8", errors = "replace"), flush = True, end = "") + print(line, flush = True, end = "") pass pass pass @@ -988,9 +990,10 @@ def save_to_gguf( with subprocess.Popen(command, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, bufsize = 1) as sp: for line in sp.stdout: + line = line.decode("utf-8", errors = "replace") if "undefined reference" in line: raise RuntimeError("Failed compiling llama.cpp. Please report this ASAP!") - print(line.decode("utf-8", errors = "replace"), flush = True, end = "") + print(line, flush = True, end = "") if sp.returncode is not None and sp.returncode != 0: raise subprocess.CalledProcessError(sp.returncode, sp.args) pass @@ -1031,9 +1034,10 @@ def save_to_gguf( # quantize uses stderr with subprocess.Popen(command, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, bufsize = 1) as sp: for line in sp.stdout: + line = line.decode("utf-8", errors = "replace") if "undefined reference" in line: raise RuntimeError("Failed compiling llama.cpp. Please report this ASAP!") - print(line.decode("utf-8", errors = "replace"), flush = True, end = "") + print(line, flush = True, end = "") if sp.returncode is not None and sp.returncode != 0: raise subprocess.CalledProcessError(sp.returncode, sp.args) pass