qyhfrank commited on
Commit
c017d10
β€’
1 Parent(s): e117945

chore: Reorder arguments in run_model_task function

Browse files
code_efficiency_calculator.py CHANGED
@@ -618,7 +618,7 @@ def fetch_completion(dataset,model):
618
  return dataset
619
 
620
 
621
- def run_model_task(model,task):
622
 
623
  if "/" in model:
624
  model = model.split("/")[1]
 
618
  return dataset
619
 
620
 
621
+ def run_model_task(task,model):
622
 
623
  if "/" in model:
624
  model = model.split("/")[1]
leaderboard.py CHANGED
@@ -1,8 +1,11 @@
1
  # Original code by https://huggingface.co/spaces/lmsys/chatbot-arena-leaderboard
2
  # Modified by EffiBench
3
 
 
 
4
  import pandas as pd
5
  import gradio as gr
 
6
 
7
 
8
  def make_default_md_1():
@@ -13,15 +16,11 @@ def make_default_md_1():
13
  <a href='https://github.com/huangd1999/EffiBench' style='color: {link_color}; text-decoration: none;'>GitHub</a> |
14
  <a href='https://github.com/huangd1999/EffiBench/tree/main/data' style='color: {link_color}; text-decoration: none;'>Dataset</a>
15
  """
16
-
17
  return leaderboard_md
18
 
19
- def make_default_md_2():
20
- leaderboard_md = f"""
21
- πŸ€— [filing a request](https://github.com/huangd1999/EffiBench/issues/new?assignees=&labels=model+eval&projects=&template=model_eval_request.yml&title=%F0%9F%92%A1+%5BREQUEST%5D+-+%3CMODEL_NAME%3E) to add your models on our leaderboard!**
22
- """
23
-
24
- return leaderboard_md
25
 
26
  leaderboard_md = """
27
  Three benchmarks are displayed: **EffiBench**, **HumanEval** and **MBPP**.
@@ -50,9 +49,26 @@ Please cite the following paper if you find our leaderboard or dataset helpful.
50
  }
51
  """
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  def build_leaderboard_tab(leaderboard_table_file):
54
  gr.Markdown(make_default_md_1(), elem_id="leaderboard_markdown")
55
- gr.Markdown(make_default_md_2(), elem_id="leaderboard_markdown")
56
 
57
  df = pd.read_csv(leaderboard_table_file)
58
  def filter_leaderboard(dataset, timeout):
@@ -79,7 +95,13 @@ def build_leaderboard_tab(leaderboard_table_file):
79
  dataset_dropdown.change(fn=update_leaderboard, inputs=[dataset_dropdown, timeout_dropdown], outputs=leaderboard)
80
  timeout_dropdown.change(fn=update_leaderboard, inputs=[dataset_dropdown, timeout_dropdown], outputs=leaderboard)
81
 
 
 
 
 
 
 
 
82
  with gr.Accordion("Citation", open=True):
83
  gr.Markdown(citation_md, elem_id="leaderboard_markdown")
84
  gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
85
-
 
1
  # Original code by https://huggingface.co/spaces/lmsys/chatbot-arena-leaderboard
2
  # Modified by EffiBench
3
 
4
+ import json
5
+ from pathlib import Path
6
  import pandas as pd
7
  import gradio as gr
8
+ from calculate_memory_usage import report_results
9
 
10
 
11
  def make_default_md_1():
 
16
  <a href='https://github.com/huangd1999/EffiBench' style='color: {link_color}; text-decoration: none;'>GitHub</a> |
17
  <a href='https://github.com/huangd1999/EffiBench/tree/main/data' style='color: {link_color}; text-decoration: none;'>Dataset</a>
18
  """
 
19
  return leaderboard_md
20
 
21
+ add_model_md = f"""
22
+ πŸ€— [filing a request](https://github.com/huangd1999/EffiBench/issues/new?assignees=&labels=model+eval&projects=&template=model_eval_request.yml&title=%F0%9F%92%A1+%5BREQUEST%5D+-+%3CMODEL_NAME%3E) to add your models on our leaderboard!**
23
+ """
 
 
 
24
 
25
  leaderboard_md = """
26
  Three benchmarks are displayed: **EffiBench**, **HumanEval** and **MBPP**.
 
49
  }
50
  """
51
 
52
+ def process_uploaded_file(file):
53
+ if file is None:
54
+ return "No file uploaded."
55
+ try:
56
+ file = Path(file)
57
+ json_data = json.loads(file.read_text())
58
+ except Exception as e:
59
+ return f"Error processing the file: {str(e)}"
60
+
61
+ try:
62
+ task, model = file.stem.split("_")
63
+ except Exception as e:
64
+ return f"Error parsing the task and model name from the file name: {str(e)}! Should be in the format of <task>_<model>.json"
65
+
66
+
67
+
68
+
69
  def build_leaderboard_tab(leaderboard_table_file):
70
  gr.Markdown(make_default_md_1(), elem_id="leaderboard_markdown")
71
+ gr.Markdown(add_model_md, elem_id="leaderboard_markdown")
72
 
73
  df = pd.read_csv(leaderboard_table_file)
74
  def filter_leaderboard(dataset, timeout):
 
95
  dataset_dropdown.change(fn=update_leaderboard, inputs=[dataset_dropdown, timeout_dropdown], outputs=leaderboard)
96
  timeout_dropdown.change(fn=update_leaderboard, inputs=[dataset_dropdown, timeout_dropdown], outputs=leaderboard)
97
 
98
+ with gr.Tab("XXX"):
99
+ file_upload = gr.File(label="Upload JSON File")
100
+ upload_button = gr.Button("Process File")
101
+ output_text = gr.Textbox(label="Output")
102
+
103
+ upload_button.click(process_uploaded_file, inputs=file_upload, outputs=output_text)
104
+
105
  with gr.Accordion("Citation", open=True):
106
  gr.Markdown(citation_md, elem_id="leaderboard_markdown")
107
  gr.Markdown(acknowledgment_md, elem_id="ack_markdown")
 
requirements.txt CHANGED
@@ -1 +1,3 @@
1
- plotly
 
 
 
1
+ plotly
2
+ line_profiler
3
+ memory_profiler