From 1fb4a6276f0ceb8c3a9152c88e5630b1c37bbf9c Mon Sep 17 00:00:00 2001 From: rainlizard <15337628+rainlizard@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:41:02 +1100 Subject: [PATCH] fix freeze if temporary file exists --- EasyQuantizationGUI.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/EasyQuantizationGUI.py b/EasyQuantizationGUI.py index 744fd16..b6c238c 100644 --- a/EasyQuantizationGUI.py +++ b/EasyQuantizationGUI.py @@ -123,6 +123,20 @@ def run_llama_quantize(): output_dir = os.path.dirname(output_file) temp_gguf_file = os.path.join(output_dir, "temporary_file_during_quantization") + # Add cleanup of existing temp file + if os.path.exists(temp_gguf_file): + try: + os.remove(temp_gguf_file) + process_text.insert(tk.END, "Cleaned up existing temporary file.\n") + process_text.see(tk.END) + root.update() + except Exception as e: + process_text.insert(tk.END, f"Error cleaning up temporary file: {e}\n") + process_text.see(tk.END) + root.update() + enable_ui() + return + try: startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW