Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Terry Zhuo commited on
Commit ·
7207b80
1
Parent(s): 44749d0
rm lock
Browse files11 unmodified lines1213141516171849 unmodified lines68697071727374757677786 unmodified lines8586878889909115 unmodified lines10710810911011111211311457 unmodified lines17217317417517617717811 unmodified linesdefault_command = "bigcodebench.evaluate"is_running = Falselock = threading.Lock()def generate_command(jsonl_file, split, subset, parallel,49 unmodified linesdef run_bigcodebench(command):global is_runningwith lock:if is_running:yield "A command is already running. Please wait for it to finish.\n"returnis_running = Truetry:yield f"Executing command: {command}\n"6 unmodified linesis_running = Falseyield "Process terminated after 6 minutes timeout.\n"# Start a timer to kill the process after 6 minutestimer = threading.Timer(360, kill_process)timer.start()15 unmodified lineselse:yield "No result file found.\n"finally:with lock:is_running = Falsedef stream_logs(command, jsonl_file=None):global is_running57 unmodified linesyield log, gr.update(value=result_path, label=result_path), gr.update()else:yield log, gr.update(), gr.update()is_running = Falseresult_file = find_result_file()if result_file:return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)11 unmodified lines12131415161749 unmodified lines676869707172737475766 unmodified lines8384858687888915 unmodified lines10510610710810911011157 unmodified lines16917017117217317411 unmodified linesdefault_command = "bigcodebench.evaluate"is_running = Falsedef generate_command(jsonl_file, split, subset, parallel,49 unmodified linesdef run_bigcodebench(command):global is_runningif is_running:yield "A command is already running. Please wait for it to finish.\n"returnis_running = Truetry:yield f"Executing command: {command}\n"6 unmodified linesis_running = Falseyield "Process terminated after 6 minutes timeout.\n"Start a timer to kill the process after 6 minutestimer = threading.Timer(360, kill_process)timer.start()15 unmodified lineselse:yield "No result file found.\n"finally:is_running = Falsedef stream_logs(command, jsonl_file=None):global is_running57 unmodified linesyield log, gr.update(value=result_path, label=result_path), gr.update()else:yield log, gr.update(), gr.update()result_file = find_result_file()if result_file:return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)
app.py+6-10