Spaces:
Runtime error
Runtime error
kexinhuang12345
commited on
Commit
·
df330ee
1
Parent(s):
4d5ee1c
bug fix
Browse files- app.py +0 -9
- src/display/utils.py +3 -3
- src/populate.py +18 -6
- src/submission/submit.py +10 -2
app.py
CHANGED
|
@@ -429,15 +429,6 @@ with demo:
|
|
| 429 |
submission_result,
|
| 430 |
)
|
| 431 |
|
| 432 |
-
with gr.Row():
|
| 433 |
-
with gr.Accordion("📙 Citation", open=False):
|
| 434 |
-
citation_button = gr.Textbox(
|
| 435 |
-
value=CITATION_BUTTON_TEXT,
|
| 436 |
-
label=CITATION_BUTTON_LABEL,
|
| 437 |
-
lines=20,
|
| 438 |
-
elem_id="citation-button",
|
| 439 |
-
show_copy_button=True,
|
| 440 |
-
)
|
| 441 |
|
| 442 |
scheduler = BackgroundScheduler()
|
| 443 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
|
|
|
| 429 |
submission_result,
|
| 430 |
)
|
| 431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
|
| 433 |
scheduler = BackgroundScheduler()
|
| 434 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
src/display/utils.py
CHANGED
|
@@ -48,7 +48,7 @@ auto_eval_column_dict_nc = []
|
|
| 48 |
auto_eval_column_dict_nc.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 49 |
auto_eval_column_dict_nc.append(["average_rank", ColumnContent, ColumnContent("Average Rank⬆️", "number", True)])
|
| 50 |
for task in nc_tasks:
|
| 51 |
-
auto_eval_column_dict_nc.append(['_'.join(task.value.col_name.split('-')), ColumnContent, ColumnContent(task.value.
|
| 52 |
auto_eval_column_dict_nc.append(["author", ColumnContent, ColumnContent("Author", "markdown", True, never_hidden=False)])
|
| 53 |
auto_eval_column_dict_nc.append(["email", ColumnContent, ColumnContent("Email", "markdown", True, never_hidden=False)])
|
| 54 |
auto_eval_column_dict_nc.append(["Paper_URL", ColumnContent, ColumnContent("Paper URL", "markdown", True, never_hidden=False)])
|
|
@@ -63,7 +63,7 @@ auto_eval_column_dict_nr = []
|
|
| 63 |
auto_eval_column_dict_nr.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 64 |
auto_eval_column_dict_nr.append(["average_rank", ColumnContent, ColumnContent("Average Rank⬆️", "number", True)])
|
| 65 |
for task in nr_tasks:
|
| 66 |
-
auto_eval_column_dict_nr.append(['_'.join(task.value.col_name.split('-')), ColumnContent, ColumnContent(task.value.
|
| 67 |
auto_eval_column_dict_nr.append(["author", ColumnContent, ColumnContent("Author", "markdown", True, never_hidden=False)])
|
| 68 |
auto_eval_column_dict_nr.append(["email", ColumnContent, ColumnContent("Email", "markdown", True, never_hidden=False)])
|
| 69 |
auto_eval_column_dict_nr.append(["Paper_URL", ColumnContent, ColumnContent("Paper URL", "markdown", True, never_hidden=False)])
|
|
@@ -78,7 +78,7 @@ auto_eval_column_dict_lp = []
|
|
| 78 |
auto_eval_column_dict_lp.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 79 |
auto_eval_column_dict_lp.append(["average_rank", ColumnContent, ColumnContent("Average Rank⬆️", "number", True)])
|
| 80 |
for task in lp_tasks:
|
| 81 |
-
auto_eval_column_dict_lp.append(['_'.join(task.value.col_name.split('-')), ColumnContent, ColumnContent(task.value.
|
| 82 |
auto_eval_column_dict_lp.append(["author", ColumnContent, ColumnContent("Author", "markdown", True, never_hidden=False)])
|
| 83 |
auto_eval_column_dict_lp.append(["email", ColumnContent, ColumnContent("Email", "markdown", True, never_hidden=False)])
|
| 84 |
auto_eval_column_dict_lp.append(["Paper_URL", ColumnContent, ColumnContent("Paper URL", "markdown", True, never_hidden=False)])
|
|
|
|
| 48 |
auto_eval_column_dict_nc.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 49 |
auto_eval_column_dict_nc.append(["average_rank", ColumnContent, ColumnContent("Average Rank⬆️", "number", True)])
|
| 50 |
for task in nc_tasks:
|
| 51 |
+
auto_eval_column_dict_nc.append(['_'.join(task.value.col_name.split('-')), ColumnContent, ColumnContent(task.value.benchmark, "number", True)])
|
| 52 |
auto_eval_column_dict_nc.append(["author", ColumnContent, ColumnContent("Author", "markdown", True, never_hidden=False)])
|
| 53 |
auto_eval_column_dict_nc.append(["email", ColumnContent, ColumnContent("Email", "markdown", True, never_hidden=False)])
|
| 54 |
auto_eval_column_dict_nc.append(["Paper_URL", ColumnContent, ColumnContent("Paper URL", "markdown", True, never_hidden=False)])
|
|
|
|
| 63 |
auto_eval_column_dict_nr.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 64 |
auto_eval_column_dict_nr.append(["average_rank", ColumnContent, ColumnContent("Average Rank⬆️", "number", True)])
|
| 65 |
for task in nr_tasks:
|
| 66 |
+
auto_eval_column_dict_nr.append(['_'.join(task.value.col_name.split('-')), ColumnContent, ColumnContent(task.value.benchmark, "number", True)])
|
| 67 |
auto_eval_column_dict_nr.append(["author", ColumnContent, ColumnContent("Author", "markdown", True, never_hidden=False)])
|
| 68 |
auto_eval_column_dict_nr.append(["email", ColumnContent, ColumnContent("Email", "markdown", True, never_hidden=False)])
|
| 69 |
auto_eval_column_dict_nr.append(["Paper_URL", ColumnContent, ColumnContent("Paper URL", "markdown", True, never_hidden=False)])
|
|
|
|
| 78 |
auto_eval_column_dict_lp.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 79 |
auto_eval_column_dict_lp.append(["average_rank", ColumnContent, ColumnContent("Average Rank⬆️", "number", True)])
|
| 80 |
for task in lp_tasks:
|
| 81 |
+
auto_eval_column_dict_lp.append(['_'.join(task.value.col_name.split('-')), ColumnContent, ColumnContent(task.value.benchmark, "number", True)])
|
| 82 |
auto_eval_column_dict_lp.append(["author", ColumnContent, ColumnContent("Author", "markdown", True, never_hidden=False)])
|
| 83 |
auto_eval_column_dict_lp.append(["email", ColumnContent, ColumnContent("Email", "markdown", True, never_hidden=False)])
|
| 84 |
auto_eval_column_dict_lp.append(["Paper_URL", ColumnContent, ColumnContent("Paper URL", "markdown", True, never_hidden=False)])
|
src/populate.py
CHANGED
|
@@ -2,6 +2,7 @@ import json
|
|
| 2 |
import os
|
| 3 |
from ast import literal_eval
|
| 4 |
import pandas as pd
|
|
|
|
| 5 |
|
| 6 |
from src.display.formatting import has_no_nan_values, make_clickable_model
|
| 7 |
from src.display.utils import AutoEvalColumn, EvalQueueColumn
|
|
@@ -12,6 +13,14 @@ from src.about import (
|
|
| 12 |
lp_tasks,
|
| 13 |
)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
'''
|
| 16 |
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
| 17 |
"""Creates a dataframe from all the individual experiment results"""
|
|
@@ -26,7 +35,8 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 26 |
#df = df[has_no_nan_values(df, benchmark_cols)]
|
| 27 |
return raw_data, df
|
| 28 |
'''
|
| 29 |
-
|
|
|
|
| 30 |
def get_leaderboard_df(EVAL_REQUESTS_PATH, task_type) -> pd.DataFrame:
|
| 31 |
if task_type == 'Node Classification':
|
| 32 |
ascending = False
|
|
@@ -54,17 +64,19 @@ def get_leaderboard_df(EVAL_REQUESTS_PATH, task_type) -> pd.DataFrame:
|
|
| 54 |
model_res.append(out)
|
| 55 |
|
| 56 |
for model in model_res:
|
| 57 |
-
model["test"] = literal_eval(model["test"])
|
| 58 |
-
model["valid"] = literal_eval(model["valid"])
|
| 59 |
#model["params"] = int(model["params"])
|
| 60 |
model['submitted_time'] = model['submitted_time'].split('T')[0]
|
| 61 |
#model['paper_url'] = '[Link](' + model['paper_url'] + ')'
|
| 62 |
#model['github_url'] = '[Link](' + model['github_url'] + ')'
|
| 63 |
|
| 64 |
-
name2short_name = {task.value.benchmark: task.value.
|
| 65 |
for model in model_res:
|
| 66 |
-
model.update({
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
columns_to_show = ['model', 'author', 'email', 'paper_url', 'github_url', 'submitted_time'] + list(name2short_name.values())
|
| 69 |
|
| 70 |
# Check if model_res is empty
|
|
|
|
| 2 |
import os
|
| 3 |
from ast import literal_eval
|
| 4 |
import pandas as pd
|
| 5 |
+
import re
|
| 6 |
|
| 7 |
from src.display.formatting import has_no_nan_values, make_clickable_model
|
| 8 |
from src.display.utils import AutoEvalColumn, EvalQueueColumn
|
|
|
|
| 13 |
lp_tasks,
|
| 14 |
)
|
| 15 |
|
| 16 |
+
def sanitize_string(input_string):
|
| 17 |
+
# Remove leading and trailing whitespace
|
| 18 |
+
input_string = input_string.strip()
|
| 19 |
+
|
| 20 |
+
# Remove leading whitespace on each line
|
| 21 |
+
sanitized_string = re.sub(r'(?m)^\s+', '', input_string)
|
| 22 |
+
|
| 23 |
+
return sanitized_string
|
| 24 |
'''
|
| 25 |
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
| 26 |
"""Creates a dataframe from all the individual experiment results"""
|
|
|
|
| 35 |
#df = df[has_no_nan_values(df, benchmark_cols)]
|
| 36 |
return raw_data, df
|
| 37 |
'''
|
| 38 |
+
def format_number(num):
|
| 39 |
+
return f"{num:.3f}"
|
| 40 |
def get_leaderboard_df(EVAL_REQUESTS_PATH, task_type) -> pd.DataFrame:
|
| 41 |
if task_type == 'Node Classification':
|
| 42 |
ascending = False
|
|
|
|
| 64 |
model_res.append(out)
|
| 65 |
|
| 66 |
for model in model_res:
|
| 67 |
+
model["test"] = literal_eval(model["test"].split('}')[0]+'}')
|
| 68 |
+
model["valid"] = literal_eval(model["valid"].split('}')[0]+'}')
|
| 69 |
#model["params"] = int(model["params"])
|
| 70 |
model['submitted_time'] = model['submitted_time'].split('T')[0]
|
| 71 |
#model['paper_url'] = '[Link](' + model['paper_url'] + ')'
|
| 72 |
#model['github_url'] = '[Link](' + model['github_url'] + ')'
|
| 73 |
|
| 74 |
+
name2short_name = {task.value.benchmark: task.value.benchmark for task in tasks}
|
| 75 |
for model in model_res:
|
| 76 |
+
model.update({
|
| 77 |
+
name2short_name[i]: (f"{format_number(model['test'][i][0])} ± {format_number(model['test'][i][1])}" if i in model['test'] else '-')
|
| 78 |
+
for i in name2short_name
|
| 79 |
+
})
|
| 80 |
columns_to_show = ['model', 'author', 'email', 'paper_url', 'github_url', 'submitted_time'] + list(name2short_name.values())
|
| 81 |
|
| 82 |
# Check if model_res is empty
|
src/submission/submit.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
from datetime import datetime, timezone
|
|
|
|
| 4 |
|
| 5 |
from src.display.formatting import styled_error, styled_message, styled_warning
|
| 6 |
from src.envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
|
|
@@ -78,10 +79,17 @@ def add_new_eval(
|
|
| 78 |
"task": task_track,
|
| 79 |
"private": False,
|
| 80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
# TODO: Check for duplicate submission
|
| 83 |
-
#if f"{model}
|
| 84 |
-
# return
|
| 85 |
|
| 86 |
print("Creating eval file")
|
| 87 |
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{model}"
|
|
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
+
from ast import literal_eval
|
| 5 |
|
| 6 |
from src.display.formatting import styled_error, styled_message, styled_warning
|
| 7 |
from src.envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
|
|
|
|
| 79 |
"task": task_track,
|
| 80 |
"private": False,
|
| 81 |
}
|
| 82 |
+
|
| 83 |
+
## add a checking to verify if the submission has no bug
|
| 84 |
+
try:
|
| 85 |
+
xx = literal_eval(eval_entry["test"])
|
| 86 |
+
xx = literal_eval(eval_entry["valid"])
|
| 87 |
+
except:
|
| 88 |
+
return styled_error("The testing/validation performance submitted do not follow the correct format. Please check the format and resubmit.")
|
| 89 |
|
| 90 |
# TODO: Check for duplicate submission
|
| 91 |
+
#if f"{model}" in REQUESTED_MODELS:
|
| 92 |
+
# return styled_error("This model has been already submitted.")
|
| 93 |
|
| 94 |
print("Creating eval file")
|
| 95 |
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{model}"
|