Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Clรฉmentine
commited on
Commit
โข
8131376
1
Parent(s):
a39f12a
updated webhook so it updates queue too
Browse files- app.py +26 -25
- src/display/about.py +2 -0
app.py
CHANGED
@@ -58,8 +58,8 @@ from gradio_space_ci.webhook import IS_EPHEMERAL_SPACE, SPACE_ID, configure_spac
|
|
58 |
|
59 |
# Convert the environment variable "LEADERBOARD_FULL_INIT" to a boolean value, defaulting to True if the variable is not set.
|
60 |
# This controls whether a full initialization should be performed.
|
61 |
-
DO_FULL_INIT = os.getenv("LEADERBOARD_FULL_INIT", "True") == "True"
|
62 |
-
|
63 |
LEADERBOARD_DF = None
|
64 |
|
65 |
def restart_space():
|
@@ -103,29 +103,30 @@ def download_dataset(repo_id, local_dir, repo_type="dataset", max_attempts=3, ba
|
|
103 |
raise Exception(f"Failed to download {repo_id} after {max_attempts} attempts")
|
104 |
|
105 |
def get_latest_data_leaderboard(leaderboard_initial_df = None):
|
106 |
-
|
107 |
-
global LAST_UPDATE_LEADERBOARD
|
108 |
-
if current_time - LAST_UPDATE_LEADERBOARD < datetime.timedelta(minutes=10) and leaderboard_initial_df is not None:
|
109 |
-
return leaderboard_initial_df
|
110 |
-
LAST_UPDATE_LEADERBOARD = current_time
|
111 |
-
leaderboard_dataset = datasets.load_dataset(
|
112 |
-
AGGREGATED_REPO,
|
113 |
-
"default",
|
114 |
-
split="train",
|
115 |
-
cache_dir=HF_HOME,
|
116 |
-
download_mode=datasets.DownloadMode.REUSE_DATASET_IF_EXISTS, # Uses the cached dataset
|
117 |
-
verification_mode="no_checks"
|
118 |
-
)
|
119 |
-
|
120 |
global LEADERBOARD_DF
|
121 |
-
|
122 |
-
leaderboard_dataset=
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
return LEADERBOARD_DF
|
128 |
|
|
|
129 |
def get_latest_data_queue():
|
130 |
eval_queue_dfs = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
131 |
return eval_queue_dfs
|
@@ -221,9 +222,6 @@ with main_block:
|
|
221 |
|
222 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
223 |
|
224 |
-
# Adding a markdown element with the documentation link
|
225 |
-
gr.Markdown("Feeling lost? Documentation is [here](https://huggingface.co/docs/leaderboards/open_llm_leaderboard/about) ๐", elem_classes="markdown-text")
|
226 |
-
|
227 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
228 |
with gr.TabItem("๐
LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
229 |
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
@@ -436,6 +434,9 @@ webhooks_server = enable_space_ci_and_return_server(ui=main_block)
|
|
436 |
def update_leaderboard(payload: WebhookPayload) -> None:
|
437 |
"""Redownloads the leaderboard dataset each time it updates"""
|
438 |
if payload.repo.type == "dataset" and payload.event.action == "update":
|
|
|
|
|
|
|
439 |
datasets.load_dataset(
|
440 |
AGGREGATED_REPO,
|
441 |
"default",
|
@@ -457,7 +458,7 @@ def update_queue(payload: WebhookPayload) -> None:
|
|
457 |
print("Would have updated the queue")
|
458 |
# We only redownload is last update was more than 10 minutes ago, as the queue is
|
459 |
# updated regularly and heavy to download
|
460 |
-
|
461 |
LAST_UPDATE_QUEUE = datetime.datetime.now()
|
462 |
|
463 |
webhooks_server.launch()
|
|
|
58 |
|
59 |
# Convert the environment variable "LEADERBOARD_FULL_INIT" to a boolean value, defaulting to True if the variable is not set.
|
60 |
# This controls whether a full initialization should be performed.
|
61 |
+
DO_FULL_INIT = True # os.getenv("LEADERBOARD_FULL_INIT", "True") == "True"
|
62 |
+
NEW_DATA_ON_LEADERBOARD = True
|
63 |
LEADERBOARD_DF = None
|
64 |
|
65 |
def restart_space():
|
|
|
103 |
raise Exception(f"Failed to download {repo_id} after {max_attempts} attempts")
|
104 |
|
105 |
def get_latest_data_leaderboard(leaderboard_initial_df = None):
|
106 |
+
global NEW_DATA_ON_LEADERBOARD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
global LEADERBOARD_DF
|
108 |
+
if NEW_DATA_ON_LEADERBOARD:
|
109 |
+
leaderboard_dataset = datasets.load_dataset(
|
110 |
+
AGGREGATED_REPO,
|
111 |
+
"default",
|
112 |
+
split="train",
|
113 |
+
cache_dir=HF_HOME,
|
114 |
+
download_mode=datasets.DownloadMode.REUSE_DATASET_IF_EXISTS, # Uses the cached dataset
|
115 |
+
verification_mode="no_checks"
|
116 |
+
)
|
117 |
+
LEADERBOARD_DF = get_leaderboard_df(
|
118 |
+
leaderboard_dataset=leaderboard_dataset,
|
119 |
+
cols=COLS,
|
120 |
+
benchmark_cols=BENCHMARK_COLS,
|
121 |
+
)
|
122 |
+
NEW_DATA_ON_LEADERBOARD = False
|
123 |
+
|
124 |
+
else:
|
125 |
+
LEADERBOARD_DF = leaderboard_initial_df
|
126 |
|
127 |
return LEADERBOARD_DF
|
128 |
|
129 |
+
|
130 |
def get_latest_data_queue():
|
131 |
eval_queue_dfs = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
132 |
return eval_queue_dfs
|
|
|
222 |
|
223 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
224 |
|
|
|
|
|
|
|
225 |
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
226 |
with gr.TabItem("๐
LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
227 |
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
|
|
434 |
def update_leaderboard(payload: WebhookPayload) -> None:
|
435 |
"""Redownloads the leaderboard dataset each time it updates"""
|
436 |
if payload.repo.type == "dataset" and payload.event.action == "update":
|
437 |
+
global NEW_DATA_ON_LEADERBOARD
|
438 |
+
NEW_DATA_ON_LEADERBOARD = True
|
439 |
+
|
440 |
datasets.load_dataset(
|
441 |
AGGREGATED_REPO,
|
442 |
"default",
|
|
|
458 |
print("Would have updated the queue")
|
459 |
# We only redownload is last update was more than 10 minutes ago, as the queue is
|
460 |
# updated regularly and heavy to download
|
461 |
+
download_dataset(QUEUE_REPO, EVAL_REQUESTS_PATH)
|
462 |
LAST_UPDATE_QUEUE = datetime.datetime.now()
|
463 |
|
464 |
webhooks_server.launch()
|
src/display/about.py
CHANGED
@@ -3,6 +3,8 @@ from src.display.utils import ModelType
|
|
3 |
TITLE = """<h1 style="text-align:left;float:left; id="space-title">๐ค Open LLM Leaderboard</h1> <h3 style="text-align:left;float:left;> Track, rank and evaluate open LLMs and chatbots </h3>"""
|
4 |
|
5 |
INTRODUCTION_TEXT = """
|
|
|
|
|
6 |
"""
|
7 |
|
8 |
icons = f"""
|
|
|
3 |
TITLE = """<h1 style="text-align:left;float:left; id="space-title">๐ค Open LLM Leaderboard</h1> <h3 style="text-align:left;float:left;> Track, rank and evaluate open LLMs and chatbots </h3>"""
|
4 |
|
5 |
INTRODUCTION_TEXT = """
|
6 |
+
Feeling lost? Documentation is [here](https://huggingface.co/docs/leaderboards/open_llm_leaderboard/about) ๐
|
7 |
+
You'll notably find explanations on the evaluations we are using, reproducibility guidelines, best practices on how to submit a model, and our FAQ.
|
8 |
"""
|
9 |
|
10 |
icons = f"""
|