Spaces:
Sleeping
Sleeping
Commit
·
2866958
1
Parent(s):
78e97f9
init
Browse files- app.py +15 -15
- src/display/utils.py +1 -1
- src/leaderboard/read_evals.py +4 -3
app.py
CHANGED
|
@@ -33,20 +33,20 @@ def restart_space():
|
|
| 33 |
API.restart_space(repo_id=REPO_ID)
|
| 34 |
|
| 35 |
### Space initialisation
|
| 36 |
-
try:
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
except Exception:
|
| 42 |
-
|
| 43 |
-
try:
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
except Exception:
|
| 49 |
-
|
| 50 |
|
| 51 |
|
| 52 |
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
|
@@ -201,4 +201,4 @@ with demo:
|
|
| 201 |
scheduler = BackgroundScheduler()
|
| 202 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 203 |
scheduler.start()
|
| 204 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
|
| 33 |
API.restart_space(repo_id=REPO_ID)
|
| 34 |
|
| 35 |
### Space initialisation
|
| 36 |
+
# try:
|
| 37 |
+
# print(EVAL_REQUESTS_PATH)
|
| 38 |
+
# snapshot_download(
|
| 39 |
+
# repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
| 40 |
+
# )
|
| 41 |
+
# except Exception:
|
| 42 |
+
# restart_space()
|
| 43 |
+
# try:
|
| 44 |
+
# print(EVAL_RESULTS_PATH)
|
| 45 |
+
# snapshot_download(
|
| 46 |
+
# repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30, token=TOKEN
|
| 47 |
+
# )
|
| 48 |
+
# except Exception:
|
| 49 |
+
# restart_space()
|
| 50 |
|
| 51 |
|
| 52 |
LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
|
|
|
| 201 |
scheduler = BackgroundScheduler()
|
| 202 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 203 |
scheduler.start()
|
| 204 |
+
demo.queue(default_concurrency_limit=40).launch(share=True)
|
src/display/utils.py
CHANGED
|
@@ -6,7 +6,7 @@ import pandas as pd
|
|
| 6 |
from src.about import Tasks
|
| 7 |
|
| 8 |
def fields(raw_class):
|
| 9 |
-
return [v for k, v in raw_class.__dict__.items() if
|
| 10 |
|
| 11 |
|
| 12 |
# These classes are for user facing column names,
|
|
|
|
| 6 |
from src.about import Tasks
|
| 7 |
|
| 8 |
def fields(raw_class):
|
| 9 |
+
return [v for k, v in raw_class.__dict__.items() if isinstance(v, ColumnContent)]
|
| 10 |
|
| 11 |
|
| 12 |
# These classes are for user facing column names,
|
src/leaderboard/read_evals.py
CHANGED
|
@@ -136,7 +136,7 @@ def get_request_file_for_model(requests_path, model_name, precision):
|
|
| 136 |
"""Selects the correct request file for a given model. Only keeps runs tagged as FINISHED"""
|
| 137 |
request_files = os.path.join(
|
| 138 |
requests_path,
|
| 139 |
-
f"{model_name}_eval_request_*.json",
|
| 140 |
)
|
| 141 |
request_files = glob.glob(request_files)
|
| 142 |
|
|
@@ -147,10 +147,11 @@ def get_request_file_for_model(requests_path, model_name, precision):
|
|
| 147 |
with open(tmp_request_file, "r") as f:
|
| 148 |
req_content = json.load(f)
|
| 149 |
if (
|
| 150 |
-
req_content["status"]
|
| 151 |
-
and req_content["precision"] == precision
|
| 152 |
):
|
| 153 |
request_file = tmp_request_file
|
|
|
|
| 154 |
return request_file
|
| 155 |
|
| 156 |
|
|
|
|
| 136 |
"""Selects the correct request file for a given model. Only keeps runs tagged as FINISHED"""
|
| 137 |
request_files = os.path.join(
|
| 138 |
requests_path,
|
| 139 |
+
f"{model_name.replace('/', '__')}_eval_request_*.json",
|
| 140 |
)
|
| 141 |
request_files = glob.glob(request_files)
|
| 142 |
|
|
|
|
| 147 |
with open(tmp_request_file, "r") as f:
|
| 148 |
req_content = json.load(f)
|
| 149 |
if (
|
| 150 |
+
req_content["status"].upper() == "FINISHED"
|
| 151 |
+
and req_content["precision"] == precision
|
| 152 |
):
|
| 153 |
request_file = tmp_request_file
|
| 154 |
+
break # Found the file, no need to continue
|
| 155 |
return request_file
|
| 156 |
|
| 157 |
|