From 0c2f3952b7d7208576ce61d5ee0c5eb33fa75ce0 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Fri, 17 May 2024 14:18:52 +1000 Subject: [PATCH] Squashed commit of the following: commit 23bd794c246e9c90c453c9f2ab41a21ac1e41b9d Author: Daniel Han-Chen Date: Fri May 17 14:16:39 2024 +1000 Update save.py commit c12cc6c2b13333c4c6709e0ee88665b08c672887 Author: Daniel Han-Chen Date: Fri May 17 04:14:05 2024 +1000 peft issue --- unsloth/save.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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