Spaces:
Runtime error
Runtime error
Terry Zhuo commited on
Commit ·
a2d883f
1
Parent(s): af3bf93
update
Browse files13 unmodified lines14151617171819207 unmodified lines28293031323331323330 unmodified lines646566707172737475767778798081676869707172737475767778798081828384838485868788899085868788899091929394959697989 unmodified lines10810911010611111211311411511611711311811912011612112212311 unmodified lines13513613713413813914014110 unmodified lines15215315415115515615715813 unmodified linesis_running = False
def generate_command( jsonl_file, split, subset, save_pass_rate, parallel, jsonl_file, split, subset, parallel, min_time_limit, max_as_limit, max_data_limit, max_stack_limit, check_gt_only, no_gt):7 unmodified lines command.extend(["--split", split, "--subset", subset]) if save_pass_rate: command.append("--save_pass_rate") if parallel is not None and parallel != 0: command.extend(["--parallel", str(int(parallel))]) 30 unmodified lines
def run_bigcodebench(command): global is_running is_running = True yield f"Executing command: {command}\n" process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) for line in process.stdout: yield line process.wait() if process.returncode != 0: yield f"Error: Command exited with status {process.returncode}\n" with lock: if is_running: yield "A command is already running. Please wait for it to finish.\n" return is_running = True
try: yield f"Executing command: {command}\n" process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) for line in process.stdout: yield line process.wait() if process.returncode != 0: yield f"Error: Command exited with status {process.returncode}\n" is_running = False yield "Evaluation completed.\n"
result_file = find_result_file() if result_file: yield f"Result file found: {result_file}\n" else: yield "No result file found.\n" yield "Evaluation completed.\n" result_file = find_result_file() if result_file: yield f"Result file found: {result_file}\n" else: yield "No result file found.\n" finally: with lock: is_running = False
def stream_logs(command, jsonl_file=None): global is_running9 unmodified lines for log_line in run_bigcodebench(command): log_content.append(log_line) yield "".join(log_content)
with gr.Blocks() as demo: gr.Markdown("# BigCodeBench Evaluator") with gr.Row(): jsonl_file = gr.File(label="Upload JSONL file", file_types=[".jsonl"]) split = gr.Dropdown(choices=["complete", "instruct"], label="Split", value="complete") subset = gr.Dropdown(choices=["full", "hard"], label="Subset", value="hard") subset = gr.Dropdown(choices=["hard"], label="Subset", value="hard") with gr.Row(): save_pass_rate = gr.Checkbox(label="Save Pass Rate") parallel = gr.Number(label="Parallel (optional)", precision=0) min_time_limit = gr.Number(label="Min Time Limit", value=1, precision=1) max_as_limit = gr.Number(label="Max AS Limit", value=25*1024, precision=0)11 unmodified lines log_output = gr.Textbox(label="Execution Logs", lines=20) input_components = [ jsonl_file, split, subset, save_pass_rate, parallel, jsonl_file, split, subset, parallel, min_time_limit, max_as_limit, max_data_limit, max_stack_limit, check_gt_only, no_gt ]10 unmodified lines
for log in stream_logs(command, jsonl_file): yield log, gr.update(value=result_path, label=result_path), gr.update() is_running = False result_file = find_result_file() if result_file: return gr.update(label="Evaluation completed. Result file found."), gr.update(value=result_file)app.py+33-29