IlyasMoutawwakil HF staff commited on
Commit
0425d1c
1 Parent(s): 4db7f9b
base_config.yaml → configs/base_config.yaml RENAMED
File without changes
run.py CHANGED
@@ -32,7 +32,7 @@ def run_benchmark(kwargs):
32
  arguments = [
33
  "optimum-benchmark",
34
  "--config-dir",
35
- "./",
36
  "--config-name",
37
  "base_config",
38
  f"task={task}",
@@ -53,8 +53,9 @@ def run_benchmark(kwargs):
53
  else:
54
  arguments.append(f"{label}={value}")
55
 
56
- command = " ".join(arguments)
57
- yield gr.update(value=command), gr.update(interactive=False), gr.update(visible=False)
 
58
 
59
  # stream subprocess output
60
  process = subprocess.Popen(
@@ -86,11 +87,11 @@ def run_benchmark(kwargs):
86
  # stream html output to gradio
87
  yield gr.update(value=html_text), gr.update(interactive=False), gr.update(visible=False)
88
 
89
- # read runs/{experiment_name}/{benchmark}_results.csv
 
 
 
 
90
 
91
- table = pd.read_csv(f"runs/{experiment_name}/{benchmark}_results.csv", index_col=0)
92
-
93
- print(table.to_dict("records"))
94
- yield gr.update(value=html_text), gr.update(interactive=True), gr.Dataframe.update(
95
- visible=True, value={"headers": list(table.columns), "data": table.values.tolist()}
96
- )
 
32
  arguments = [
33
  "optimum-benchmark",
34
  "--config-dir",
35
+ "./configs",
36
  "--config-name",
37
  "base_config",
38
  f"task={task}",
 
53
  else:
54
  arguments.append(f"{label}={value}")
55
 
56
+ command = "<br>".join(arguments)
57
+ html_text = f"<h3>Running command:</h3>{command}"
58
+ yield gr.update(value=html_text), gr.update(interactive=False), gr.update(visible=False)
59
 
60
  # stream subprocess output
61
  process = subprocess.Popen(
 
87
  # stream html output to gradio
88
  yield gr.update(value=html_text), gr.update(interactive=False), gr.update(visible=False)
89
 
90
+ if process.returncode != 0:
91
+ table = pd.read_csv(f"runs/{experiment_name}/{benchmark}_results.csv", index_col=0)
92
+ table_update = gr.update(visible=True, value={"headers": list(table.columns), "data": table.values.tolist()})
93
+ else:
94
+ table_update = gr.update(visible=False)
95
 
96
+ yield gr.update(value=html_text), gr.update(interactive=True), table_update
97
+ return