Spaces:
Running
Running
remove snapshot downloader
Browse files
app.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
import subprocess
|
| 2 |
import gradio as gr
|
| 3 |
import pandas as pd
|
| 4 |
-
|
| 5 |
-
from
|
|
|
|
|
|
|
| 6 |
|
| 7 |
from src.about import (
|
| 8 |
-
CITATION_BUTTON_LABEL,
|
| 9 |
-
CITATION_BUTTON_TEXT,
|
| 10 |
-
EVALUATION_QUEUE_TEXT,
|
| 11 |
INTRODUCTION_TEXT,
|
| 12 |
LLM_BENCHMARKS_TEXT,
|
| 13 |
TITLE,
|
|
@@ -24,9 +26,11 @@ from src.display.utils import (
|
|
| 24 |
ModelType,
|
| 25 |
fields,
|
| 26 |
WeightType,
|
| 27 |
-
Precision
|
| 28 |
)
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
| 31 |
from src.submission.submit import add_new_eval
|
| 32 |
|
|
@@ -34,20 +38,31 @@ from src.submission.submit import add_new_eval
|
|
| 34 |
def restart_space():
|
| 35 |
API.restart_space(repo_id=REPO_ID)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
raw_data, original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
|
@@ -86,9 +101,7 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
|
| 86 |
AutoEvalColumn.model.name,
|
| 87 |
]
|
| 88 |
# We use COLS to maintain sorting
|
| 89 |
-
filtered_df = df[
|
| 90 |
-
always_here_cols + [c for c in COLS if c in df.columns and c in columns]
|
| 91 |
-
]
|
| 92 |
return filtered_df
|
| 93 |
|
| 94 |
|
|
@@ -149,11 +162,7 @@ with demo:
|
|
| 149 |
)
|
| 150 |
with gr.Row():
|
| 151 |
shown_columns = gr.CheckboxGroup(
|
| 152 |
-
choices=[
|
| 153 |
-
c.name
|
| 154 |
-
for c in fields(AutoEvalColumn)
|
| 155 |
-
if not c.hidden and not c.never_hidden
|
| 156 |
-
],
|
| 157 |
value=[
|
| 158 |
c.name
|
| 159 |
for c in fields(AutoEvalColumn)
|
|
@@ -168,7 +177,7 @@ with demo:
|
|
| 168 |
value=False, label="Show gated/private/deleted models", interactive=True
|
| 169 |
)
|
| 170 |
with gr.Column(min_width=320):
|
| 171 |
-
#with gr.Box(elem_id="box-filter"):
|
| 172 |
filter_columns_type = gr.CheckboxGroup(
|
| 173 |
label="Model types",
|
| 174 |
choices=[t.to_str() for t in ModelType],
|
|
@@ -192,10 +201,7 @@ with demo:
|
|
| 192 |
)
|
| 193 |
|
| 194 |
leaderboard_table = gr.components.Dataframe(
|
| 195 |
-
value=leaderboard_df[
|
| 196 |
-
[c.name for c in fields(AutoEvalColumn) if c.never_hidden]
|
| 197 |
-
+ shown_columns.value
|
| 198 |
-
],
|
| 199 |
headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
|
| 200 |
datatype=TYPES,
|
| 201 |
elem_id="leaderboard-table",
|
|
@@ -223,7 +229,13 @@ with demo:
|
|
| 223 |
],
|
| 224 |
leaderboard_table,
|
| 225 |
)
|
| 226 |
-
for selector in [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
selector.change(
|
| 228 |
update_table,
|
| 229 |
[
|
|
@@ -242,104 +254,17 @@ with demo:
|
|
| 242 |
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
| 243 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
| 244 |
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
datatype=EVAL_TYPES,
|
| 260 |
-
row_count=5,
|
| 261 |
-
)
|
| 262 |
-
with gr.Accordion(
|
| 263 |
-
f"🔄 Running Evaluation Queue ({len(running_eval_queue_df)})",
|
| 264 |
-
open=False,
|
| 265 |
-
):
|
| 266 |
-
with gr.Row():
|
| 267 |
-
running_eval_table = gr.components.Dataframe(
|
| 268 |
-
value=running_eval_queue_df,
|
| 269 |
-
headers=EVAL_COLS,
|
| 270 |
-
datatype=EVAL_TYPES,
|
| 271 |
-
row_count=5,
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
with gr.Accordion(
|
| 275 |
-
f"⏳ Pending Evaluation Queue ({len(pending_eval_queue_df)})",
|
| 276 |
-
open=False,
|
| 277 |
-
):
|
| 278 |
-
with gr.Row():
|
| 279 |
-
pending_eval_table = gr.components.Dataframe(
|
| 280 |
-
value=pending_eval_queue_df,
|
| 281 |
-
headers=EVAL_COLS,
|
| 282 |
-
datatype=EVAL_TYPES,
|
| 283 |
-
row_count=5,
|
| 284 |
-
)
|
| 285 |
-
with gr.Row():
|
| 286 |
-
gr.Markdown("# ✉️✨ Submit your model here!", elem_classes="markdown-text")
|
| 287 |
-
|
| 288 |
-
with gr.Row():
|
| 289 |
-
with gr.Column():
|
| 290 |
-
model_name_textbox = gr.Textbox(label="Model name")
|
| 291 |
-
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
| 292 |
-
model_type = gr.Dropdown(
|
| 293 |
-
choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
|
| 294 |
-
label="Model type",
|
| 295 |
-
multiselect=False,
|
| 296 |
-
value=None,
|
| 297 |
-
interactive=True,
|
| 298 |
-
)
|
| 299 |
-
|
| 300 |
-
with gr.Column():
|
| 301 |
-
precision = gr.Dropdown(
|
| 302 |
-
choices=[i.value.name for i in Precision if i != Precision.Unknown],
|
| 303 |
-
label="Precision",
|
| 304 |
-
multiselect=False,
|
| 305 |
-
value="float16",
|
| 306 |
-
interactive=True,
|
| 307 |
-
)
|
| 308 |
-
weight_type = gr.Dropdown(
|
| 309 |
-
choices=[i.value.name for i in WeightType],
|
| 310 |
-
label="Weights type",
|
| 311 |
-
multiselect=False,
|
| 312 |
-
value="Original",
|
| 313 |
-
interactive=True,
|
| 314 |
-
)
|
| 315 |
-
base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
|
| 316 |
-
|
| 317 |
-
submit_button = gr.Button("Submit Eval")
|
| 318 |
-
submission_result = gr.Markdown()
|
| 319 |
-
submit_button.click(
|
| 320 |
-
add_new_eval,
|
| 321 |
-
[
|
| 322 |
-
model_name_textbox,
|
| 323 |
-
base_model_name_textbox,
|
| 324 |
-
revision_name_textbox,
|
| 325 |
-
precision,
|
| 326 |
-
weight_type,
|
| 327 |
-
model_type,
|
| 328 |
-
],
|
| 329 |
-
submission_result,
|
| 330 |
-
)
|
| 331 |
-
|
| 332 |
-
with gr.Row():
|
| 333 |
-
with gr.Accordion("📙 Citation", open=False):
|
| 334 |
-
citation_button = gr.Textbox(
|
| 335 |
-
value=CITATION_BUTTON_TEXT,
|
| 336 |
-
label=CITATION_BUTTON_LABEL,
|
| 337 |
-
lines=20,
|
| 338 |
-
elem_id="citation-button",
|
| 339 |
-
show_copy_button=True,
|
| 340 |
-
)
|
| 341 |
-
|
| 342 |
-
scheduler = BackgroundScheduler()
|
| 343 |
-
scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 344 |
-
scheduler.start()
|
| 345 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
|
| 1 |
import subprocess
|
| 2 |
import gradio as gr
|
| 3 |
import pandas as pd
|
| 4 |
+
|
| 5 |
+
# from apscheduler.schedulers.background import BackgroundScheduler
|
| 6 |
+
|
| 7 |
+
# from huggingface_hub import snapshot_download
|
| 8 |
|
| 9 |
from src.about import (
|
| 10 |
+
# CITATION_BUTTON_LABEL,
|
| 11 |
+
# CITATION_BUTTON_TEXT,
|
| 12 |
+
# EVALUATION_QUEUE_TEXT,
|
| 13 |
INTRODUCTION_TEXT,
|
| 14 |
LLM_BENCHMARKS_TEXT,
|
| 15 |
TITLE,
|
|
|
|
| 26 |
ModelType,
|
| 27 |
fields,
|
| 28 |
WeightType,
|
| 29 |
+
Precision,
|
| 30 |
)
|
| 31 |
+
|
| 32 |
+
# from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
| 33 |
+
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, REPO_ID
|
| 34 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
| 35 |
from src.submission.submit import add_new_eval
|
| 36 |
|
|
|
|
| 38 |
def restart_space():
|
| 39 |
API.restart_space(repo_id=REPO_ID)
|
| 40 |
|
| 41 |
+
|
| 42 |
+
# try:
|
| 43 |
+
# print(EVAL_REQUESTS_PATH)
|
| 44 |
+
# snapshot_download(
|
| 45 |
+
# repo_id=QUEUE_REPO,
|
| 46 |
+
# local_dir=EVAL_REQUESTS_PATH,
|
| 47 |
+
# repo_type="dataset",
|
| 48 |
+
# tqdm_class=None,
|
| 49 |
+
# etag_timeout=30,
|
| 50 |
+
# token=TOKEN,
|
| 51 |
+
# )
|
| 52 |
+
# except Exception:
|
| 53 |
+
# restart_space()
|
| 54 |
+
# try:
|
| 55 |
+
# print(EVAL_RESULTS_PATH)
|
| 56 |
+
# snapshot_download(
|
| 57 |
+
# repo_id=RESULTS_REPO,
|
| 58 |
+
# local_dir=EVAL_RESULTS_PATH,
|
| 59 |
+
# repo_type="dataset",
|
| 60 |
+
# tqdm_class=None,
|
| 61 |
+
# etag_timeout=30,
|
| 62 |
+
# token=TOKEN,
|
| 63 |
+
# )
|
| 64 |
+
# except Exception:
|
| 65 |
+
# restart_space()
|
| 66 |
|
| 67 |
|
| 68 |
raw_data, original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
|
|
|
| 101 |
AutoEvalColumn.model.name,
|
| 102 |
]
|
| 103 |
# We use COLS to maintain sorting
|
| 104 |
+
filtered_df = df[always_here_cols + [c for c in COLS if c in df.columns and c in columns]]
|
|
|
|
|
|
|
| 105 |
return filtered_df
|
| 106 |
|
| 107 |
|
|
|
|
| 162 |
)
|
| 163 |
with gr.Row():
|
| 164 |
shown_columns = gr.CheckboxGroup(
|
| 165 |
+
choices=[c.name for c in fields(AutoEvalColumn) if not c.hidden and not c.never_hidden],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
value=[
|
| 167 |
c.name
|
| 168 |
for c in fields(AutoEvalColumn)
|
|
|
|
| 177 |
value=False, label="Show gated/private/deleted models", interactive=True
|
| 178 |
)
|
| 179 |
with gr.Column(min_width=320):
|
| 180 |
+
# with gr.Box(elem_id="box-filter"):
|
| 181 |
filter_columns_type = gr.CheckboxGroup(
|
| 182 |
label="Model types",
|
| 183 |
choices=[t.to_str() for t in ModelType],
|
|
|
|
| 201 |
)
|
| 202 |
|
| 203 |
leaderboard_table = gr.components.Dataframe(
|
| 204 |
+
value=leaderboard_df[[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value],
|
|
|
|
|
|
|
|
|
|
| 205 |
headers=[c.name for c in fields(AutoEvalColumn) if c.never_hidden] + shown_columns.value,
|
| 206 |
datatype=TYPES,
|
| 207 |
elem_id="leaderboard-table",
|
|
|
|
| 229 |
],
|
| 230 |
leaderboard_table,
|
| 231 |
)
|
| 232 |
+
for selector in [
|
| 233 |
+
shown_columns,
|
| 234 |
+
filter_columns_type,
|
| 235 |
+
filter_columns_precision,
|
| 236 |
+
filter_columns_size,
|
| 237 |
+
deleted_models_visibility,
|
| 238 |
+
]:
|
| 239 |
selector.change(
|
| 240 |
update_table,
|
| 241 |
[
|
|
|
|
| 254 |
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
| 255 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
| 256 |
|
| 257 |
+
# with gr.Row():
|
| 258 |
+
# with gr.Accordion("📙 Citation", open=False):
|
| 259 |
+
# citation_button = gr.Textbox(
|
| 260 |
+
# value=CITATION_BUTTON_TEXT,
|
| 261 |
+
# label=CITATION_BUTTON_LABEL,
|
| 262 |
+
# lines=20,
|
| 263 |
+
# elem_id="citation-button",
|
| 264 |
+
# show_copy_button=True,
|
| 265 |
+
# )
|
| 266 |
+
|
| 267 |
+
# scheduler = BackgroundScheduler()
|
| 268 |
+
# scheduler.add_job(restart_space, "interval", seconds=1800)
|
| 269 |
+
# scheduler.start()
|
| 270 |
+
demo.queue(default_concurrency_limit=40).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|