Skip to content

Commit 1fb4a62

Browse files
committed
fix freeze if temporary file exists
1 parent 37933ff commit 1fb4a62

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

EasyQuantizationGUI.py

+14
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,20 @@ def run_llama_quantize():
123123
output_dir = os.path.dirname(output_file)
124124
temp_gguf_file = os.path.join(output_dir, "temporary_file_during_quantization")
125125

126+
# Add cleanup of existing temp file
127+
if os.path.exists(temp_gguf_file):
128+
try:
129+
os.remove(temp_gguf_file)
130+
process_text.insert(tk.END, "Cleaned up existing temporary file.\n")
131+
process_text.see(tk.END)
132+
root.update()
133+
except Exception as e:
134+
process_text.insert(tk.END, f"Error cleaning up temporary file: {e}\n")
135+
process_text.see(tk.END)
136+
root.update()
137+
enable_ui()
138+
return
139+
126140
try:
127141
startupinfo = subprocess.STARTUPINFO()
128142
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

0 commit comments

Comments
 (0)