yuanshengni commited on
Commit
6590844
·
1 Parent(s): a7d2921

Update submit tab

Browse files
Files changed (6) hide show
  1. .gitignore +24 -0
  2. __pycache__/utils.cpython-39.pyc +0 -0
  3. app.py +21 -50
  4. leaderboard/results.csv +0 -25
  5. requirements.txt +1 -1
  6. utils.py +59 -10
.gitignore ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ignore compiled Python files
2
+ *.pyc
3
+ *.pyo
4
+ __pycache__/
5
+
6
+ # Ignore virtual environment files
7
+ venv/
8
+ env/
9
+ .env/
10
+
11
+ # Ignore package build files
12
+ build/
13
+ dist/
14
+ *.egg-info/
15
+
16
+ # Ignore IDE and editor files
17
+ .vscode/
18
+ .idea/
19
+ *.sublime-project
20
+ *.sublime-workspace
21
+
22
+ # Ignore system-specific files
23
+ .DS_Store
24
+ Thumbs.db
__pycache__/utils.cpython-39.pyc DELETED
Binary file (3.21 kB)
 
app.py CHANGED
@@ -1,8 +1,7 @@
1
- import gradio as gr
2
- import pandas as pd
3
-
4
  from utils import *
5
 
 
 
6
  block = gr.Blocks()
7
 
8
  with block:
@@ -10,7 +9,7 @@ with block:
10
  LEADERBORAD_INTRODUCTION
11
  )
12
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
13
- # Table 0
14
  with gr.TabItem("📊 TheoremQA", elem_id="theoremqa-tab-table1", id=1):
15
  with gr.Row():
16
  with gr.Accordion("Citation", open=False):
@@ -24,67 +23,39 @@ with block:
24
  TABLE_INTRODUCTION
25
  )
26
 
27
- gr.components.Dataframe(
28
- value=pd.read_csv(CSV_DIR),
29
  headers=COLUMN_NAMES,
30
  type="pandas",
31
  datatype=DATA_TITILE_TYPE,
32
  interactive=False,
33
  visible=True,
34
  )
 
 
35
 
 
36
  with gr.TabItem("📝 About", elem_id="theoremqa-tab-table2", id=2):
37
  gr.Markdown(LEADERBORAD_INFO, elem_classes="markdown-text")
38
 
39
  # table 3
40
- # with gr.TabItem("🚀 Submit here! ", elem_id="mtheoremqa-tab-table", id=3):
41
- # gr.Markdown(LEADERBORAD_INTRODUCTION, elem_classes="markdown-text")
42
-
43
- # with gr.Row():
44
- # gr.Markdown(SUBMIT_INTRODUCTION, elem_classes="markdown-text")
45
-
46
- # with gr.Row():
47
- # gr.Markdown("# ✉️✨ Submit your model evaluation json file here!", elem_classes="markdown-text")
48
-
49
- # with gr.Row():
50
- # with gr.Column():
51
- # model_name_textbox = gr.Textbox(
52
- # label="Model name", placeholder="LaVie"
53
- # )
54
- # revision_name_textbox = gr.Textbox(
55
- # label="Revision Model Name", placeholder="LaVie"
56
- # )
57
-
58
- # with gr.Column():
59
- # model_link = gr.Textbox(
60
- # label="Model Link", placeholder="https://huggingface.co/decapoda-research/llama-7b-hf"
61
- # )
62
 
 
 
63
 
64
- # with gr.Column():
65
 
66
- # input_file = gr.components.File(label = "Click to Upload a json File", file_count="single", type='binary')
67
- # submit_button = gr.Button("Submit Eval")
68
 
69
- # submission_result = gr.Markdown()
70
- # submit_button.click(
71
- # add_new_eval,
72
- # inputs = [
73
- # input_file,
74
- # model_name_textbox,
75
- # revision_name_textbox,
76
- # model_link,
77
- # ],
78
- # )
79
-
80
-
81
- # def refresh_data():
82
- # value1 = get_baseline_df()
83
- # return value1
84
-
85
- # with gr.Row():
86
- # data_run = gr.Button("Refresh")
87
- # data_run.click(on_filter_model_size_method_change, inputs=[checkbox_group], outputs=data_component)
88
 
89
 
90
  block.launch()
 
 
 
 
1
  from utils import *
2
 
3
+ global data_component
4
+
5
  block = gr.Blocks()
6
 
7
  with block:
 
9
  LEADERBORAD_INTRODUCTION
10
  )
11
  with gr.Tabs(elem_classes="tab-buttons") as tabs:
12
+ # Table 1
13
  with gr.TabItem("📊 TheoremQA", elem_id="theoremqa-tab-table1", id=1):
14
  with gr.Row():
15
  with gr.Accordion("Citation", open=False):
 
23
  TABLE_INTRODUCTION
24
  )
25
 
26
+ data_component=gr.components.Dataframe(
27
+ value=get_df(),
28
  headers=COLUMN_NAMES,
29
  type="pandas",
30
  datatype=DATA_TITILE_TYPE,
31
  interactive=False,
32
  visible=True,
33
  )
34
+ refresh_button = gr.Button("Refresh")
35
+ refresh_button.click(fn=refresh_data, outputs=data_component)
36
 
37
+ # table 2
38
  with gr.TabItem("📝 About", elem_id="theoremqa-tab-table2", id=2):
39
  gr.Markdown(LEADERBORAD_INFO, elem_classes="markdown-text")
40
 
41
  # table 3
42
+ with gr.TabItem("🚀 Submit here! ", elem_id="mtheoremqa-tab-table", id=3):
43
+ with gr.Row():
44
+ gr.Markdown(SUBMIT_INTRODUCTION, elem_classes="markdown-text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ with gr.Row():
47
+ gr.Markdown("# ✉️✨ Submit your json file here!", elem_classes="markdown-text")
48
 
49
+ with gr.Column():
50
 
51
+ input_file = gr.components.File(label = "Click to Upload a json File", file_count="single", type='binary')
52
+ submit_button = gr.Button("Submit Results")
53
 
54
+ submission_result = gr.Markdown()
55
+ submit_button.click(
56
+ add_new_eval,
57
+ inputs=[input_file],
58
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
 
61
  block.launch()
leaderboard/results.csv DELETED
@@ -1,25 +0,0 @@
1
- Model (CoT),TheoremQA,MATH,GSM
2
- Mistral-v0.2-base,19.2,10.2,36.2
3
- Mixtral-7x8B-base,23.2,22.1,58.4
4
- Qwen-1.5-7B,14.2,13.3,54.1
5
- Qwen-1.5-14B,14,25.2,61.6
6
- Qwen-1.5-72B,29.3,35.1,77.6
7
- Yi-6B,12,5.8,32.6
8
- Yi-34B,23.2,15.9,67.9
9
- ChatGLM3-6B,11.3,25.7,72.3
10
- Gemma-7B,21.5,24.3,46.4
11
- LLaMA-2-13B,10.9,5,29.6
12
- LLeMMA-7B,17.2,18,36.4
13
- LLeMMA-34B,21.1,25,71.9
14
- InternLM2-7B,7.8,20.2,70.8
15
- InternLM2-20B,19.5,25.5,76.1
16
- Deepseek-7B,15.7,6.4,17.4
17
- Deepseek-67B,25.3,15.9,66.5
18
- GPT-4-0409,0,69.2,94.5
19
- InternLM-Math-20B,17.1,37.7,82.9
20
- Deepseek-Math-7B,27.1,36.2,64.2
21
- Deepseek-Math-7B-Instruct,23.7,46.8,82.9
22
- WizardMath-7B-1.1,11.7,33,83.2
23
- MetaMath-Mistral-7B,16.5,28.2,77.7
24
- Abel-7B-002,19.3,29.5,83.2
25
- OpenMath-Mistral-7B,13.1,44.5,80.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio==3.23.0
2
  pandas==2.0.0
 
1
+ gradio==4.26.0
2
  pandas==2.0.0
utils.py CHANGED
@@ -1,20 +1,26 @@
 
 
 
 
 
 
 
 
 
 
1
  MODEL_INFO = [
2
- "Model Name (clickable)",
 
3
  "TheoremQA",
4
  "MATH",
5
  "GSM",
6
  ]
7
 
8
- MODEL_INFO_TAB_QUALITY = [
9
- "Model Name (clickable)",
10
- "Quality Score",
11
- "Selected Score"
12
- ]
13
-
14
-
15
- DATA_TITILE_TYPE = ['markdown', 'number', 'number', 'number']
16
 
17
- CSV_DIR = "./leaderboard/results.csv"
 
 
18
 
19
  COLUMN_NAMES = MODEL_INFO
20
 
@@ -47,3 +53,46 @@ CITATION_BUTTON_TEXT = r"""@inproceedings{chen2023theoremqa,
47
  booktitle={The 2023 Conference on Empirical Methods in Natural Language Processing},
48
  year={2023}
49
  }"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import gradio as gr
3
+ import csv
4
+ import json
5
+ import os
6
+ import shutil
7
+ from huggingface_hub import Repository
8
+
9
+ HF_TOKEN = os.environ.get("HF_TOKEN")
10
+
11
  MODEL_INFO = [
12
+ "Model (CoT)",
13
+ "Avg",
14
  "TheoremQA",
15
  "MATH",
16
  "GSM",
17
  ]
18
 
19
+ DATA_TITILE_TYPE = ['markdown', 'number', 'number', 'number', 'number']
 
 
 
 
 
 
 
20
 
21
+ SUBMISSION_NAME = "science_leaderboard_submission"
22
+ SUBMISSION_URL = os.path.join("https://huggingface.co/datasets/TIGER-Lab/", SUBMISSION_NAME)
23
+ CSV_DIR = "./science_leaderboard_submission/results.csv"
24
 
25
  COLUMN_NAMES = MODEL_INFO
26
 
 
53
  booktitle={The 2023 Conference on Empirical Methods in Natural Language Processing},
54
  year={2023}
55
  }"""
56
+
57
+ SUBMIT_INTRODUCTION = """# Submit on TheoremQA Leaderboard Introduction
58
+
59
+ ## ⚠ Please note that you need to submit the json file with following format:
60
+
61
+ ```json
62
+ {
63
+ "Model Name": "Model X",
64
+ "TheoremQA": 0.5,
65
+ "MATH": 0.5,
66
+ "GSM": 0.5
67
+ }
68
+ ```
69
+ After submitting, you can click the "Refresh" button to see the updated leaderboard(it may takes few seconds).
70
+
71
+ """
72
+ def get_df():
73
+ repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN)
74
+ repo.git_pull()
75
+ df = pd.read_csv(CSV_DIR)
76
+ df['Avg'] = df[['TheoremQA', 'MATH', 'GSM']].mean(axis=1).round(1)
77
+ return df[COLUMN_NAMES]
78
+
79
+ def add_new_eval(
80
+ input_file,
81
+ ):
82
+ if input_file is None:
83
+ return "Error! Empty file!"
84
+
85
+ upload_data=json.loads(input_file)
86
+ data_row = [upload_data['ModelName'], upload_data['TheoremQA'], upload_data['MATH'], upload_data['GSM']]
87
+
88
+ submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
89
+ submission_repo.git_pull()
90
+
91
+ with open(CSV_DIR, mode='a', newline='') as file:
92
+ writer = csv.writer(file)
93
+ writer.writerow(data_row)
94
+
95
+ submission_repo.push_to_hub()
96
+
97
+ def refresh_data():
98
+ return get_df()