Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Harheem Kim
commited on
Commit
·
e27700b
1
Parent(s):
5a2133a
init
Browse files- .DS_Store +0 -0
- .gitattributes +1 -0
- Makefile +0 -13
- README.md +2 -33
- app.py +13 -197
- banner.png +3 -0
- combined_evaluation_summary.csv +7 -0
- components/__init__.py +0 -0
- components/leaderboard_components.py +467 -0
- krew_icon.png +3 -0
- pyproject.toml +0 -13
- requirements.txt +4 -15
- src/about.py +0 -72
- src/display/css_html_js.py +0 -105
- src/display/formatting.py +0 -27
- src/display/utils.py +0 -110
- src/envs.py +0 -25
- src/leaderboard/read_evals.py +0 -196
- src/populate.py +0 -58
- src/submission/check_validity.py +0 -99
- src/submission/submit.py +0 -119
- styles/__init__.py +0 -0
- styles/leaderboard_styles.py +397 -0
- tabs/leaderboard_v1.py +0 -0
- utils.py +149 -0
- visualization.py +258 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 35 |
scale-hf-logo.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 35 |
scale-hf-logo.png filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
Makefile
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
.PHONY: style format
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
style:
|
| 5 |
-
python -m black --line-length 119 .
|
| 6 |
-
python -m isort .
|
| 7 |
-
ruff check --fix .
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
quality:
|
| 11 |
-
python -m black --check --line-length 119 .
|
| 12 |
-
python -m isort --check-only .
|
| 13 |
-
ruff check .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -7,42 +7,11 @@ sdk: gradio
|
|
| 7 |
app_file: app.py
|
| 8 |
pinned: true
|
| 9 |
license: apache-2.0
|
| 10 |
-
short_description:
|
| 11 |
sdk_version: 5.43.1
|
| 12 |
tags:
|
| 13 |
- leaderboard
|
| 14 |
---
|
| 15 |
|
| 16 |
-
# Start the configuration
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
Results files should have the following format and be stored as json files:
|
| 21 |
-
```json
|
| 22 |
-
{
|
| 23 |
-
"config": {
|
| 24 |
-
"model_dtype": "torch.float16", # or torch.bfloat16 or 8bit or 4bit
|
| 25 |
-
"model_name": "path of the model on the hub: org/model",
|
| 26 |
-
"model_sha": "revision on the hub",
|
| 27 |
-
},
|
| 28 |
-
"results": {
|
| 29 |
-
"task_name": {
|
| 30 |
-
"metric_name": score,
|
| 31 |
-
},
|
| 32 |
-
"task_name2": {
|
| 33 |
-
"metric_name": score,
|
| 34 |
-
}
|
| 35 |
-
}
|
| 36 |
-
}
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
Request files are created automatically by this tool.
|
| 40 |
-
|
| 41 |
-
If you encounter problem on the space, don't hesitate to restart it to remove the create eval-queue, eval-queue-bk, eval-results and eval-results-bk created folder.
|
| 42 |
-
|
| 43 |
-
# Code logic for more complex edits
|
| 44 |
-
|
| 45 |
-
You'll find
|
| 46 |
-
- the main table' columns names and properties in `src/display/utils.py`
|
| 47 |
-
- the logic to read all results and request files, then convert them in dataframe lines, in `src/leaderboard/read_evals.py`, and `src/populate.py`
|
| 48 |
-
- the logic to allow or filter submissions in `src/submission/submit.py` and `src/submission/check_validity.py`
|
|
|
|
| 7 |
app_file: app.py
|
| 8 |
pinned: true
|
| 9 |
license: apache-2.0
|
| 10 |
+
short_description: Ranking of LLMs for agentic tasks
|
| 11 |
sdk_version: 5.43.1
|
| 12 |
tags:
|
| 13 |
- leaderboard
|
| 14 |
---
|
| 15 |
|
|
|
|
| 16 |
|
| 17 |
+
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,204 +1,20 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import pandas as pd
|
| 4 |
-
from apscheduler.schedulers.background import BackgroundScheduler
|
| 5 |
-
from huggingface_hub import snapshot_download
|
| 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,
|
| 14 |
-
)
|
| 15 |
-
from src.display.css_html_js import custom_css
|
| 16 |
-
from src.display.utils import (
|
| 17 |
-
BENCHMARK_COLS,
|
| 18 |
-
COLS,
|
| 19 |
-
EVAL_COLS,
|
| 20 |
-
EVAL_TYPES,
|
| 21 |
-
AutoEvalColumn,
|
| 22 |
-
ModelType,
|
| 23 |
-
fields,
|
| 24 |
-
WeightType,
|
| 25 |
-
Precision
|
| 26 |
-
)
|
| 27 |
-
from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
|
| 28 |
-
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
| 29 |
-
from src.submission.submit import add_new_eval
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
def restart_space():
|
| 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)
|
| 53 |
-
|
| 54 |
-
(
|
| 55 |
-
finished_eval_queue_df,
|
| 56 |
-
running_eval_queue_df,
|
| 57 |
-
pending_eval_queue_df,
|
| 58 |
-
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
| 59 |
|
| 60 |
-
|
| 61 |
-
if dataframe is None or dataframe.empty:
|
| 62 |
-
raise ValueError("Leaderboard DataFrame is empty or None.")
|
| 63 |
-
return Leaderboard(
|
| 64 |
-
value=dataframe,
|
| 65 |
-
datatype=[c.type for c in fields(AutoEvalColumn)],
|
| 66 |
-
select_columns=SelectColumns(
|
| 67 |
-
default_selection=[c.name for c in fields(AutoEvalColumn) if c.displayed_by_default],
|
| 68 |
-
cant_deselect=[c.name for c in fields(AutoEvalColumn) if c.never_hidden],
|
| 69 |
-
label="Select Columns to Display:",
|
| 70 |
-
),
|
| 71 |
-
search_columns=[AutoEvalColumn.model.name, AutoEvalColumn.license.name],
|
| 72 |
-
hide_columns=[c.name for c in fields(AutoEvalColumn) if c.hidden],
|
| 73 |
-
filter_columns=[
|
| 74 |
-
ColumnFilter(AutoEvalColumn.model_type.name, type="checkboxgroup", label="Model types"),
|
| 75 |
-
ColumnFilter(AutoEvalColumn.precision.name, type="checkboxgroup", label="Precision"),
|
| 76 |
-
ColumnFilter(
|
| 77 |
-
AutoEvalColumn.params.name,
|
| 78 |
-
type="slider",
|
| 79 |
-
min=0.01,
|
| 80 |
-
max=150,
|
| 81 |
-
label="Select the number of parameters (B)",
|
| 82 |
-
),
|
| 83 |
-
ColumnFilter(
|
| 84 |
-
AutoEvalColumn.still_on_hub.name, type="boolean", label="Deleted/incomplete", default=True
|
| 85 |
-
),
|
| 86 |
-
],
|
| 87 |
-
bool_checkboxgroup_label="Hide models",
|
| 88 |
-
interactive=False,
|
| 89 |
-
)
|
| 90 |
|
|
|
|
|
|
|
| 91 |
|
| 92 |
-
demo = gr.Blocks(css=custom_css)
|
| 93 |
-
with demo:
|
| 94 |
-
gr.HTML(TITLE)
|
| 95 |
-
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
| 96 |
-
|
| 97 |
-
with gr.Tabs(elem_classes="tab-buttons") as tabs:
|
| 98 |
-
with gr.TabItem("🏅 LLM Benchmark", elem_id="llm-benchmark-tab-table", id=0):
|
| 99 |
-
leaderboard = init_leaderboard(LEADERBOARD_DF)
|
| 100 |
-
|
| 101 |
-
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
| 102 |
-
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
| 103 |
-
|
| 104 |
-
with gr.TabItem("🚀 Submit here! ", elem_id="llm-benchmark-tab-table", id=3):
|
| 105 |
-
with gr.Column():
|
| 106 |
-
with gr.Row():
|
| 107 |
-
gr.Markdown(EVALUATION_QUEUE_TEXT, elem_classes="markdown-text")
|
| 108 |
-
|
| 109 |
-
with gr.Column():
|
| 110 |
-
with gr.Accordion(
|
| 111 |
-
f"✅ Finished Evaluations ({len(finished_eval_queue_df)})",
|
| 112 |
-
open=False,
|
| 113 |
-
):
|
| 114 |
-
with gr.Row():
|
| 115 |
-
finished_eval_table = gr.components.Dataframe(
|
| 116 |
-
value=finished_eval_queue_df,
|
| 117 |
-
headers=EVAL_COLS,
|
| 118 |
-
datatype=EVAL_TYPES,
|
| 119 |
-
row_count=5,
|
| 120 |
-
)
|
| 121 |
-
with gr.Accordion(
|
| 122 |
-
f"🔄 Running Evaluation Queue ({len(running_eval_queue_df)})",
|
| 123 |
-
open=False,
|
| 124 |
-
):
|
| 125 |
-
with gr.Row():
|
| 126 |
-
running_eval_table = gr.components.Dataframe(
|
| 127 |
-
value=running_eval_queue_df,
|
| 128 |
-
headers=EVAL_COLS,
|
| 129 |
-
datatype=EVAL_TYPES,
|
| 130 |
-
row_count=5,
|
| 131 |
-
)
|
| 132 |
-
|
| 133 |
-
with gr.Accordion(
|
| 134 |
-
f"⏳ Pending Evaluation Queue ({len(pending_eval_queue_df)})",
|
| 135 |
-
open=False,
|
| 136 |
-
):
|
| 137 |
-
with gr.Row():
|
| 138 |
-
pending_eval_table = gr.components.Dataframe(
|
| 139 |
-
value=pending_eval_queue_df,
|
| 140 |
-
headers=EVAL_COLS,
|
| 141 |
-
datatype=EVAL_TYPES,
|
| 142 |
-
row_count=5,
|
| 143 |
-
)
|
| 144 |
-
with gr.Row():
|
| 145 |
-
gr.Markdown("# ✉️✨ Submit your model here!", elem_classes="markdown-text")
|
| 146 |
-
|
| 147 |
-
with gr.Row():
|
| 148 |
-
with gr.Column():
|
| 149 |
-
model_name_textbox = gr.Textbox(label="Model name")
|
| 150 |
-
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
| 151 |
-
model_type = gr.Dropdown(
|
| 152 |
-
choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
|
| 153 |
-
label="Model type",
|
| 154 |
-
multiselect=False,
|
| 155 |
-
value=None,
|
| 156 |
-
interactive=True,
|
| 157 |
-
)
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
value="float16",
|
| 165 |
-
interactive=True,
|
| 166 |
-
)
|
| 167 |
-
weight_type = gr.Dropdown(
|
| 168 |
-
choices=[i.value.name for i in WeightType],
|
| 169 |
-
label="Weights type",
|
| 170 |
-
multiselect=False,
|
| 171 |
-
value="Original",
|
| 172 |
-
interactive=True,
|
| 173 |
-
)
|
| 174 |
-
base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
|
| 175 |
|
| 176 |
-
|
| 177 |
-
submission_result = gr.Markdown()
|
| 178 |
-
submit_button.click(
|
| 179 |
-
add_new_eval,
|
| 180 |
-
[
|
| 181 |
-
model_name_textbox,
|
| 182 |
-
base_model_name_textbox,
|
| 183 |
-
revision_name_textbox,
|
| 184 |
-
precision,
|
| 185 |
-
weight_type,
|
| 186 |
-
model_type,
|
| 187 |
-
],
|
| 188 |
-
submission_result,
|
| 189 |
-
)
|
| 190 |
|
| 191 |
-
with gr.Row():
|
| 192 |
-
with gr.Accordion("📙 Citation", open=False):
|
| 193 |
-
citation_button = gr.Textbox(
|
| 194 |
-
value=CITATION_BUTTON_TEXT,
|
| 195 |
-
label=CITATION_BUTTON_LABEL,
|
| 196 |
-
lines=20,
|
| 197 |
-
elem_id="citation-button",
|
| 198 |
-
show_copy_button=True,
|
| 199 |
-
)
|
| 200 |
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
scheduler.start()
|
| 204 |
-
demo.queue(default_concurrency_limit=40).launch()
|
|
|
|
| 1 |
+
# Add this at the top of your script
|
| 2 |
+
import warnings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
warnings.filterwarnings("ignore")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
import gradio as gr
|
| 7 |
+
from tabs.leaderboard_v1 import create_leaderboard_v2_interface
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
def create_app():
|
| 11 |
+
with gr.Blocks(
|
| 12 |
+
theme=gr.themes.Default(primary_hue=gr.themes.colors.red)
|
| 13 |
+
) as app:
|
| 14 |
+
create_leaderboard_v2_interface()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
return app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
demo = create_app()
|
| 20 |
+
demo.launch()
|
|
|
|
|
|
banner.png
ADDED
|
Git LFS Details
|
combined_evaluation_summary.csv
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Model,Vendor,Model Type,L1_Total_Tasks,L2_Total_Tasks,L3_Total_Tasks,L4_Total_Tasks,L5_Total_Tasks,L6_Total_Tasks,L7_Total_Tasks,L1_Evaluated_Tasks,L2_Evaluated_Tasks,L3_Evaluated_Tasks,L4_Evaluated_Tasks,L5_Evaluated_Tasks,L6_Evaluated_Tasks,L7_Evaluated_Tasks,L1_Avg_Exec_Time,L2_Avg_Exec_Time,L3_Avg_Exec_Time,L4_Avg_Exec_Time,L5_Avg_Exec_Time,L6_Avg_Exec_Time,L7_Avg_Exec_Time,L1_Avg_Tokens,L2_Avg_Tokens,L3_Avg_Tokens,L4_Avg_Tokens,L5_Avg_Tokens,L6_Avg_Tokens,L7_Avg_Tokens,L1_Avg_TPS,L2_Avg_TPS,L3_Avg_TPS,L4_Avg_TPS,L5_Avg_TPS,L6_Avg_TPS,L7_Avg_TPS,L1_Avg_TTFT,L2_Avg_TTFT,L3_Avg_TTFT,L4_Avg_TTFT,L5_Avg_TTFT,L6_Avg_TTFT,L7_Avg_TTFT,L1_RRR,L2_RRR,L3_RRR,L4_RRR,L5_RRR,L6_RRR,L7_RRR,L1_SR,L2_SR,L3_SR,L4_SR,L5_SR,L6_SR,L7_SR,L1_EPR_CVR,L2_EPR_CVR,L3_EPR_CVR,L4_EPR_CVR,L5_EPR_CVR,L6_EPR_CVR,L7_EPR_CVR,L1_pass@k,L2_pass@k,L3_pass@k,L4_pass@k,L5_pass@k,L6_pass@k,L7_pass@k,L1_TooAcc,L1_ArgAcc,L1_CallEM,L1_RespOK,L2_SelectAcc,L3_FSM,L3_PSM,L3_ΔSteps_norm,L3_ProvAcc,L4_Coverage,L4_SourceEPR,L5_AdaptiveRoutingScore,L5_FallbackSR,L6_ReuseRage,L6_RedundantCallRate,L6_EffScore,L7_ContextRetention,L7_RefRecall
|
| 2 |
+
kanana-1.5-8b-instruct-2505,Kakao,OSS,11,30,10,10,20,15,10,11,30,10,10,20,15,10,5.53,17.22,14.51,23.78,9.44,52.98,47.39,4556.36,6107.6,5723.4,7188.3,5665.9,28502.33,28738.1,823.46,354.62,394.38,302.24,599.94,538.01,606.41,1.5236,6.7827,5.9015,7.4927,1.4163,7.764,5.1605,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.8409,0.925,0.55,0.55,0.45,0.7167,0.4,1.0,1.0,1.0,0.9,0.225,1.0,0.9,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.6364,0.2727,1.0,1.0,0.0,0.5333,0.0,0.0,0.2667,0.2667,0.225,0.45,0.4,1.0,0.6,0.825,0.75
|
| 3 |
+
skt_A.X-4.0-Light,SKT,OSS,11,30,10,10,20,15,10,11,30,10,10,20,15,10,5.15,17.37,21.51,9.06,9.23,38.97,33.94,4286.73,7456.1,13579.8,2284.9,6500.85,27744.0,25032.0,833.07,429.13,631.27,252.27,704.42,711.88,737.55,1.3615,5.8379,6.0725,6.2881,1.3627,5.3648,3.902,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.5455,0.7417,0.525,0.35,0.2875,0.55,0.45,1.0,1.0,1.0,0.3,0.2583,0.8667,0.9,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.8182,0.4545,1.0,1.0,0.2,0.7833,0.65,0.1,0.05,0.05,0.25,0.55,0.4,1.0,0.4667,0.8,0.775
|
| 4 |
+
qwen3-8B,알리바바,OSS,11,30,10,10,20,15,10,11,30,10,10,20,15,10,24.54,33.11,38.89,61.09,46.28,102.03,92.19,5798.0,7600.07,8380.0,14758.8,9789.4,45946.13,55163.2,236.28,229.53,215.5,241.58,211.54,450.34,598.37,11.0876,13.3456,23.3045,16.4015,8.5784,16.7883,11.2336,1.0,1.0,0.9,0.9,1.0,1.0,1.0,0.5909,0.8083,0.175,0.35,0.45,0.7833,0.525,1.0,1.0,0.4,0.9,0.2258,1.0,0.95,1.0,1.0,0.9,0.8,0.9667,1.0,1.0,1.0,0.7955,0.4545,1.0,1.0,0.2,0.3,0.2,0.1,0.4667,0.4667,0.2333,0.55,0.2,1.0,0.5667,0.85,0.775
|
| 5 |
+
gemini-2.5-pro,Google,API,11,30,10,10,20,15,10,11,30,10,10,20,15,10,9.01,10.45,11.43,29.65,15.91,43.0,33.16,5257.45,5761.23,6384.2,22304.6,7592.2,54436.6,50150.6,583.2,551.49,558.73,752.35,477.25,1266.0,1512.44,4.6263,5.4812,7.9657,8.8433,4.9659,7.1894,5.2974,0.9091,0.8,0.8,1.0,0.8,0.8667,0.9,0.8409,0.6583,0.2,0.425,0.4,0.4,0.35,0.9091,0.7667,0.2,0.7,0.1583,0.8667,0.9,0.9091,0.8,0.8,1.0,0.8,0.8667,0.9,0.9091,0.6364,0.2727,0.9091,0.7667,0.1,0.1667,0.1,0.0,0.4833,0.4833,0.1583,0.35,0.5333,1.0,0.1222,0.825,0.7
|
| 6 |
+
Qwen3-4B-Instruct-2507,알리바바,OSS,11,30,10,10,20,15,10,11,30,10,10,20,15,10,6.66,22.89,14.8,51.19,11.71,86.63,60.09,5273.09,6447.9,9087.8,17502.5,5363.85,36058.4,37068.1,791.39,281.66,613.83,341.91,458.02,416.23,616.84,2.093,9.1244,4.4172,13.7638,1.8319,14.8681,8.245,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.6364,0.6583,0.15,0.375,0.3,0.6167,0.425,1.0,1.0,1.0,0.9,0.15,1.0,1.0,1.0,1.0,1.0,0.9333,1.0,1.0,1.0,1.0,0.75,0.3636,1.0,1.0,0.2,0.6333,0.7,0.0,0.5167,0.5167,0.15,0.3,0.1333,1.0,0.4,0.875,0.8
|
| 7 |
+
Midm-2.0-Base-Instruct,KT,OSS,11,30,10,10,20,15,10,11,30,10,10,20,15,10,5.39,3.9,3.06,3.75,8.13,28.66,16.08,4185.82,2514.93,3418.3,2388.8,3084.5,22909.13,14079.1,775.89,644.46,1117.59,636.3,379.51,799.33,875.38,1.4775,1.8563,1.8855,1.6781,1.0824,1.6794,1.1356,1.0,1.0,1.0,1.0,0.95,1.0,1.0,0.5909,0.5167,0.25,0.325,0.275,0.4833,0.35,0.9091,0.5667,0.2,0.3,0.0667,0.9333,0.6,1.0,1.0,1.0,0.8667,0.9833,1.0,1.0,0.9091,0.6364,0.2727,1.0,0.5667,0.0,0.1,0.0,0.0,0.0,0.0,0.0667,0.15,0.0,0.9333,0.3,0.55,0.5
|
components/__init__.py
ADDED
|
File without changes
|
components/leaderboard_components.py
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Reusable components for the Agent Leaderboard v2
|
| 3 |
+
These are stable components that don't change frequently
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
def get_chart_colors():
|
| 7 |
+
return {
|
| 8 |
+
"Private": "#1098F7", # Airglow Blue for Proprietary
|
| 9 |
+
"Open source": "#58BC82", # Green for Open source
|
| 10 |
+
"performance_bands": ["#DCFCE7", "#FEF9C3", "#FEE2E2"],
|
| 11 |
+
"text": "#F5F6F7",
|
| 12 |
+
"background": "#01091A",
|
| 13 |
+
"grid": (0, 0, 0, 0.1), # RGBA tuple for grid
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def get_rank_badge(rank):
|
| 18 |
+
"""Generate HTML for rank badge with appropriate styling"""
|
| 19 |
+
badge_styles = {
|
| 20 |
+
1: ("1st", "linear-gradient(145deg, #ffd700, #ffc400)", "#000"),
|
| 21 |
+
2: ("2nd", "linear-gradient(145deg, #9ca3af, #787C7E)", "#fff"),
|
| 22 |
+
3: ("3rd", "linear-gradient(145deg, #CD7F32, #b36a1d)", "#fff"),
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
if rank in badge_styles:
|
| 26 |
+
label, gradient, text_color = badge_styles[rank]
|
| 27 |
+
return f"""
|
| 28 |
+
<div style="
|
| 29 |
+
display: inline-flex;
|
| 30 |
+
align-items: center;
|
| 31 |
+
justify-content: center;
|
| 32 |
+
min-width: 48px;
|
| 33 |
+
padding: 4px 12px;
|
| 34 |
+
background: {gradient};
|
| 35 |
+
color: {text_color};
|
| 36 |
+
border-radius: 6px;
|
| 37 |
+
font-weight: 600;
|
| 38 |
+
font-size: 0.9em;
|
| 39 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 40 |
+
">
|
| 41 |
+
{label}
|
| 42 |
+
</div>
|
| 43 |
+
"""
|
| 44 |
+
return f"""
|
| 45 |
+
<div style="
|
| 46 |
+
display: inline-flex;
|
| 47 |
+
align-items: center;
|
| 48 |
+
justify-content: center;
|
| 49 |
+
min-width: 28px;
|
| 50 |
+
color: #a1a1aa;
|
| 51 |
+
font-weight: 500;
|
| 52 |
+
">
|
| 53 |
+
{rank}
|
| 54 |
+
</div>
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def get_type_badge(model_type):
|
| 59 |
+
"""Generate HTML for model type badge"""
|
| 60 |
+
colors = get_chart_colors()
|
| 61 |
+
color_map = {
|
| 62 |
+
"Open source": colors.get("Open source", "#58BC82"),
|
| 63 |
+
"Proprietary": colors.get("Private", "#1098F7"),
|
| 64 |
+
"Private": colors.get("Private", "#1098F7"),
|
| 65 |
+
}
|
| 66 |
+
label_map = {
|
| 67 |
+
"Open source": "OSS",
|
| 68 |
+
"Proprietary": "API",
|
| 69 |
+
"Private": "API",
|
| 70 |
+
}
|
| 71 |
+
bg_color = color_map.get(model_type, "#4F46E5")
|
| 72 |
+
display_label = label_map.get(model_type, model_type)
|
| 73 |
+
return f"""
|
| 74 |
+
<div style="
|
| 75 |
+
display: inline-flex;
|
| 76 |
+
align-items: center;
|
| 77 |
+
padding: 4px 8px;
|
| 78 |
+
background: {bg_color};
|
| 79 |
+
color: white;
|
| 80 |
+
border-radius: 4px;
|
| 81 |
+
font-size: 0.85em;
|
| 82 |
+
font-weight: 500;
|
| 83 |
+
">
|
| 84 |
+
{display_label}
|
| 85 |
+
</div>
|
| 86 |
+
"""
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def get_output_type_badge(output_type):
|
| 90 |
+
"""Generate HTML for output type badge"""
|
| 91 |
+
if output_type == "Reasoning":
|
| 92 |
+
bg_color = "#9333ea" # Purple for reasoning
|
| 93 |
+
else:
|
| 94 |
+
bg_color = "#6b7280" # Gray for normal
|
| 95 |
+
|
| 96 |
+
return f"""
|
| 97 |
+
<div style="
|
| 98 |
+
display: inline-flex;
|
| 99 |
+
align-items: center;
|
| 100 |
+
gap: 4px;
|
| 101 |
+
padding: 4px 8px;
|
| 102 |
+
background: {bg_color};
|
| 103 |
+
color: white;
|
| 104 |
+
border-radius: 4px;
|
| 105 |
+
font-size: 0.85em;
|
| 106 |
+
font-weight: 500;
|
| 107 |
+
">
|
| 108 |
+
{output_type}
|
| 109 |
+
</div>
|
| 110 |
+
"""
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def get_score_bar(score):
|
| 114 |
+
"""Generate HTML for score bar with gradient styling and tooltip"""
|
| 115 |
+
width = score * 100
|
| 116 |
+
return f"""
|
| 117 |
+
<div style="display: flex; align-items: center; gap: 12px; width: 100%;">
|
| 118 |
+
<div style="
|
| 119 |
+
flex-grow: 1;
|
| 120 |
+
height: 8px;
|
| 121 |
+
background: rgba(245, 246, 247, 0.1);
|
| 122 |
+
border-radius: 4px;
|
| 123 |
+
overflow: hidden;
|
| 124 |
+
max-width: 200px;
|
| 125 |
+
">
|
| 126 |
+
<div style="
|
| 127 |
+
width: {width}%;
|
| 128 |
+
height: 100%;
|
| 129 |
+
background: #ffd21e;
|
| 130 |
+
border-radius: 4px;
|
| 131 |
+
transition: width 0.3s ease;
|
| 132 |
+
"></div>
|
| 133 |
+
</div>
|
| 134 |
+
<span style="
|
| 135 |
+
font-family: 'SF Mono', monospace;
|
| 136 |
+
font-weight: 600;
|
| 137 |
+
color: #F5F6F7;
|
| 138 |
+
min-width: 60px;
|
| 139 |
+
">{score:.3f}</span>
|
| 140 |
+
</div>
|
| 141 |
+
"""
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def get_metric_tooltip(metric):
|
| 145 |
+
"""Return tooltip text for different metrics"""
|
| 146 |
+
tooltips = {
|
| 147 |
+
"Avg AC": "Action Completion (AC): Measures how well the agent accomplishes user goals and completes tasks successfully. Higher is better (0-1 scale).",
|
| 148 |
+
"Avg TSQ": "Tool Selection Quality (TSQ): Evaluates the accuracy of selecting the right tools and using them with correct parameters. Higher is better (0-1 scale).",
|
| 149 |
+
"Avg Total Cost": "Average cost per conversation session in USD, including all API calls and processing. Lower is better.",
|
| 150 |
+
"Avg Session Duration": "Average time taken to complete a full conversation session from start to finish, measured in seconds. Lower is generally better.",
|
| 151 |
+
"Avg Turns": "Average number of back-and-forth exchanges needed to complete a task. Lower typically indicates more efficient task completion.",
|
| 152 |
+
"Banking AC": "Action Completion score specific to banking domain tasks.",
|
| 153 |
+
"Banking TSQ": "Tool Selection Quality score specific to banking domain tasks.",
|
| 154 |
+
"Healthcare AC": "Action Completion score specific to healthcare domain tasks.",
|
| 155 |
+
"Healthcare TSQ": "Tool Selection Quality score specific to healthcare domain tasks.",
|
| 156 |
+
"Insurance AC": "Action Completion score specific to insurance domain tasks.",
|
| 157 |
+
"Insurance TSQ": "Tool Selection Quality score specific to insurance domain tasks.",
|
| 158 |
+
"Investment AC": "Action Completion score specific to investment domain tasks.",
|
| 159 |
+
"Investment TSQ": "Tool Selection Quality score specific to investment domain tasks.",
|
| 160 |
+
"Telecom AC": "Action Completion score specific to telecom domain tasks.",
|
| 161 |
+
"Telecom TSQ": "Tool Selection Quality score specific to telecom domain tasks.",
|
| 162 |
+
}
|
| 163 |
+
return tooltips.get(metric, "")
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def get_responsive_styles():
|
| 167 |
+
"""Return responsive CSS styles for mobile devices"""
|
| 168 |
+
return """
|
| 169 |
+
<style>
|
| 170 |
+
/* Enhanced mobile responsiveness */
|
| 171 |
+
@media (max-width: 768px) {
|
| 172 |
+
/* Stack grid layouts vertically on mobile */
|
| 173 |
+
.insight-card-grid,
|
| 174 |
+
.metric-card-grid {
|
| 175 |
+
grid-template-columns: 1fr !important;
|
| 176 |
+
gap: 12px !important;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/* Adjust table for mobile */
|
| 180 |
+
.v2-styled-table {
|
| 181 |
+
font-size: 12px !important;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.v2-styled-table th,
|
| 185 |
+
.v2-styled-table td {
|
| 186 |
+
padding: 8px 6px !important;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/* Hide less important columns on mobile */
|
| 190 |
+
.v2-styled-table th:nth-child(8),
|
| 191 |
+
.v2-styled-table td:nth-child(8),
|
| 192 |
+
.v2-styled-table th:nth-child(9),
|
| 193 |
+
.v2-styled-table td:nth-child(9) {
|
| 194 |
+
display: none !important;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
/* Make score bars more compact */
|
| 198 |
+
.score-cell {
|
| 199 |
+
min-width: 120px !important;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
/* Adjust domain selector for mobile */
|
| 203 |
+
.domain-radio .wrap {
|
| 204 |
+
flex-direction: column !important;
|
| 205 |
+
gap: 8px !important;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
.domain-radio label {
|
| 209 |
+
min-width: 100% !important;
|
| 210 |
+
max-width: 100% !important;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
/* Compact filter controls on mobile */
|
| 214 |
+
.compact-filter-row {
|
| 215 |
+
flex-direction: column !important;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
.compact-radio .wrap > label {
|
| 219 |
+
font-size: 0.7rem !important;
|
| 220 |
+
padding: 4px 8px !important;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
/* Adjust navigation buttons */
|
| 224 |
+
.nav-buttons-container {
|
| 225 |
+
flex-direction: column !important;
|
| 226 |
+
gap: 8px !important;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
.nav-link-button {
|
| 230 |
+
width: 100% !important;
|
| 231 |
+
justify-content: center !important;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
/* Header adjustments */
|
| 235 |
+
h1 {
|
| 236 |
+
font-size: 2rem !important;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
h2 {
|
| 240 |
+
font-size: 1.5rem !important;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
h3 {
|
| 244 |
+
font-size: 1.2rem !important;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
/* Card padding adjustments */
|
| 248 |
+
.dark-container {
|
| 249 |
+
padding: 16px !important;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.info-box {
|
| 253 |
+
padding: 12px !important;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
/* Chart container adjustments */
|
| 257 |
+
.chart-container {
|
| 258 |
+
overflow-x: auto !important;
|
| 259 |
+
-webkit-overflow-scrolling: touch !important;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
/* Badge adjustments */
|
| 263 |
+
.badge-row {
|
| 264 |
+
flex-wrap: wrap !important;
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
.badge {
|
| 268 |
+
font-size: 0.65rem !important;
|
| 269 |
+
padding: 3px 8px !important;
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
@media (max-width: 480px) {
|
| 274 |
+
/* Ultra-compact layout for very small screens */
|
| 275 |
+
.v2-styled-table {
|
| 276 |
+
font-size: 10px !important;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/* Show only essential columns */
|
| 280 |
+
.v2-styled-table th:nth-child(n+6),
|
| 281 |
+
.v2-styled-table td:nth-child(n+6) {
|
| 282 |
+
display: none !important;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
/* Keep only Rank, Model, Type, and main scores visible */
|
| 286 |
+
.v2-styled-table th:nth-child(5),
|
| 287 |
+
.v2-styled-table td:nth-child(5) {
|
| 288 |
+
display: table-cell !important;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/* Reduce all padding */
|
| 292 |
+
* {
|
| 293 |
+
padding-left: 8px !important;
|
| 294 |
+
padding-right: 8px !important;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
/* Stack all buttons vertically */
|
| 298 |
+
.header-action-button {
|
| 299 |
+
width: 90% !important;
|
| 300 |
+
margin: 0 auto !important;
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
/* Tooltip improvements for mobile */
|
| 305 |
+
@media (hover: none) and (pointer: coarse) {
|
| 306 |
+
/* Show tooltips on tap for mobile */
|
| 307 |
+
.tooltip-trigger {
|
| 308 |
+
position: relative;
|
| 309 |
+
cursor: help;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
.tooltip-trigger:active .tooltip-content,
|
| 313 |
+
.tooltip-trigger:focus .tooltip-content {
|
| 314 |
+
display: block !important;
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
</style>
|
| 318 |
+
"""
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
def get_faq_section():
|
| 322 |
+
"""Return the FAQ section HTML"""
|
| 323 |
+
return """
|
| 324 |
+
<div class="dark-container" style="margin-top: 40px; margin-bottom: 40px;">
|
| 325 |
+
<div class="section-header">
|
| 326 |
+
<span class="section-icon" style="color: var(--accent-primary);">❓</span>
|
| 327 |
+
<h3 style="margin: 0; color: var(--text-primary); font-size: 1.5rem; font-family: 'Geist', sans-serif; font-weight: 700;">
|
| 328 |
+
Frequently Asked Questions
|
| 329 |
+
</h3>
|
| 330 |
+
</div>
|
| 331 |
+
|
| 332 |
+
<div style="margin-top: 24px;">
|
| 333 |
+
<!-- FAQ Item 1 -->
|
| 334 |
+
<details class="faq-item" style="margin-bottom: 16px; background: var(--bg-secondary); border-radius: 12px; padding: 16px; border: 1px solid var(--border-subtle);">
|
| 335 |
+
<summary style="cursor: pointer; font-weight: 600; color: var(--text-primary); font-size: 1rem; display: flex; align-items: center; gap: 8px;">
|
| 336 |
+
<span style="color: var(--accent-primary);"></span> Does the methodology favor GPT-4.1 since it uses GPT-4.1 to simulate users and tools, so GPT-4.1 ranks itself highest.
|
| 337 |
+
</summary>
|
| 338 |
+
<div style="margin-top: 12px; padding-left: 28px; color: var(--text-secondary); line-height: 1.6;">
|
| 339 |
+
<strong style="color: var(--accent-secondary);"></strong> GPT's top ranking isn't due to simulator bias. Scenarios are pre-generated with Claude and fixed for all models. The user simulator drives goal-based conversations, and the tool simulator provides synthetic responses without influencing outcomes. Evaluation uses Claude as a judge, which should theoretically favor Claude (per sycophancy theory), but GPTs still lead.
|
| 340 |
+
</div>
|
| 341 |
+
</details>
|
| 342 |
+
|
| 343 |
+
<!-- FAQ Item 2 -->
|
| 344 |
+
<details class="faq-item" style="margin-bottom: 16px; background: var(--bg-secondary); border-radius: 12px; padding: 16px; border: 1px solid var(--border-subtle);">
|
| 345 |
+
<summary style="cursor: pointer; font-weight: 600; color: var(--text-primary); font-size: 1rem; display: flex; align-items: center; gap: 8px;">
|
| 346 |
+
<span style="color: var(--accent-primary);"></span> Why does a specific model rank lower when our internal results show otherwise?
|
| 347 |
+
</summary>
|
| 348 |
+
<div style="margin-top: 12px; padding-left: 28px; color: var(--text-secondary); line-height: 1.6;">
|
| 349 |
+
<strong style="color: var(--accent-secondary);"></strong> Performance varies by prompt, task, complexity, and domain. Our evaluations kept prompts identical across models for consistency. Different evaluation methodologies and task sets can lead to different rankings.
|
| 350 |
+
</div>
|
| 351 |
+
</details>
|
| 352 |
+
|
| 353 |
+
<!-- FAQ Item 3 -->
|
| 354 |
+
<details class="faq-item" style="margin-bottom: 16px; background: var(--bg-secondary); border-radius: 12px; padding: 16px; border: 1px solid var(--border-subtle);">
|
| 355 |
+
<summary style="cursor: pointer; font-weight: 600; color: var(--text-primary); font-size: 1rem; display: flex; align-items: center; gap: 8px;">
|
| 356 |
+
<span style="color: var(--accent-primary);"></span> Why is my favorite model missing?
|
| 357 |
+
</summary>
|
| 358 |
+
<div style="margin-top: 12px; padding-left: 28px; color: var(--text-secondary); line-height: 1.6;">
|
| 359 |
+
<strong style="color: var(--accent-secondary);"></strong> We were not able to add certain models either because they were not in our initial list or had issues while running the experiments, such as improper tool call output format. We skipped some of the models which performed poorly in our leaderboard v1.
|
| 360 |
+
</div>
|
| 361 |
+
</details>
|
| 362 |
+
|
| 363 |
+
<!-- FAQ Item 4 -->
|
| 364 |
+
<details class="faq-item" style="margin-bottom: 16px; background: var(--bg-secondary); border-radius: 12px; padding: 16px; border: 1px solid var(--border-subtle);">
|
| 365 |
+
<summary style="cursor: pointer; font-weight: 600; color: var(--text-primary); font-size: 1rem; display: flex; align-items: center; gap: 8px;">
|
| 366 |
+
<span style="color: var(--accent-primary);"></span> We were surprised Gemini 2.5 Pro ranked lower. Our internal benchmarks show it's excellent for code research and AI code review tasks.
|
| 367 |
+
</summary>
|
| 368 |
+
<div style="margin-top: 12px; padding-left: 28px; color: var(--text-secondary); line-height: 1.6;">
|
| 369 |
+
<strong style="color: var(--accent-secondary);"></strong> Results differ because this leaderboard evaluates support agent scenarios only, not coding ones. Different models excel at different types of tasks, and this benchmark focuses specifically on business support agent use cases across banking, healthcare, insurance, investment, and telecom domains.
|
| 370 |
+
</div>
|
| 371 |
+
</details>
|
| 372 |
+
|
| 373 |
+
<!-- About Metrics -->
|
| 374 |
+
<div style="margin-top: 32px; padding: 20px; background: #ffd21e0d; border-radius: 12px; border: 1px solid var(--border-default);">
|
| 375 |
+
<h4 style="color: var(--text-primary); margin-top: 0; margin-bottom: 16px; font-size: 1.2rem; font-family: 'Geist', sans-serif; font-weight: 600; display: flex; align-items: center; gap: 8px;">
|
| 376 |
+
<span style="font-size: 1.3rem;">📊</span>
|
| 377 |
+
Understanding the Metrics
|
| 378 |
+
</h4>
|
| 379 |
+
|
| 380 |
+
<div style="display: grid; gap: 16px;">
|
| 381 |
+
<div>
|
| 382 |
+
<h5 style="color: var(--accent-primary); margin: 0 0 8px 0; font-size: 1rem;">Action Completion (AC)</h5>
|
| 383 |
+
<p style="color: var(--text-secondary); margin: 0; line-height: 1.5;">
|
| 384 |
+
A score from 0 to 1 measuring how successfully the agent completes the user's requested tasks. This evaluates whether the agent achieves the intended goals, follows instructions accurately, and provides complete solutions. Higher scores indicate better task completion.
|
| 385 |
+
</p>
|
| 386 |
+
</div>
|
| 387 |
+
|
| 388 |
+
<div>
|
| 389 |
+
<h5 style="color: var(--accent-primary); margin: 0 0 8px 0; font-size: 1rem;">Tool Selection Quality (TSQ)</h5>
|
| 390 |
+
<p style="color: var(--text-secondary); margin: 0; line-height: 1.5;">
|
| 391 |
+
A score from 0 to 1 evaluating how well the agent selects and uses the appropriate tools for each task. This includes choosing the right tool, using correct parameters, and proper sequencing of tool calls. Higher scores indicate better tool utilization.
|
| 392 |
+
</p>
|
| 393 |
+
</div>
|
| 394 |
+
|
| 395 |
+
<div>
|
| 396 |
+
<h5 style="color: var(--accent-primary); margin: 0 0 8px 0; font-size: 1rem;">Domain-Specific Performance</h5>
|
| 397 |
+
<p style="color: var(--text-secondary); margin: 0; line-height: 1.5;">
|
| 398 |
+
Models are tested across five business domains: Banking, Healthcare, Insurance, Investment, and Telecom. Each domain has specific scenarios and requirements that test the agent's ability to handle industry-specific tasks and terminology.
|
| 399 |
+
</p>
|
| 400 |
+
</div>
|
| 401 |
+
|
| 402 |
+
<div>
|
| 403 |
+
<h5 style="color: var(--accent-primary); margin: 0 0 8px 0; font-size: 1rem;">Efficiency Metrics</h5>
|
| 404 |
+
<p style="color: var(--text-secondary); margin: 0; line-height: 1.5;">
|
| 405 |
+
• <strong>Cost:</strong> Total API cost per session in USD<br>
|
| 406 |
+
• <strong>Duration:</strong> Time to complete tasks in seconds<br>
|
| 407 |
+
• <strong>Turns:</strong> Number of exchanges to reach resolution<br>
|
| 408 |
+
These metrics help identify the most cost-effective and efficient models for production use.
|
| 409 |
+
</p>
|
| 410 |
+
</div>
|
| 411 |
+
</div>
|
| 412 |
+
|
| 413 |
+
<div style="margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-subtle);">
|
| 414 |
+
<p style="color: var(--text-secondary); margin: 0; font-size: 0.9rem; line-height: 1.5;">
|
| 415 |
+
<strong>Learn More:</strong> For detailed methodology and evaluation criteria, visit the
|
| 416 |
+
<a href="https://galileo.ai/blog/agent-leaderboard-v2" target="_blank" style="color: var(--accent-primary); text-decoration: none;">
|
| 417 |
+
official blog post ↗
|
| 418 |
+
</a>
|
| 419 |
+
or explore the
|
| 420 |
+
<a href="https://github.com/rungalileo/agent-leaderboard" target="_blank" style="color: var(--accent-primary); text-decoration: none;">
|
| 421 |
+
GitHub repository ↗
|
| 422 |
+
</a>
|
| 423 |
+
</p>
|
| 424 |
+
</div>
|
| 425 |
+
</div>
|
| 426 |
+
</div>
|
| 427 |
+
|
| 428 |
+
<style>
|
| 429 |
+
.faq-item {
|
| 430 |
+
transition: all 0.3s ease;
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
.faq-item:hover {
|
| 434 |
+
border-color: var(--accent-primary) !important;
|
| 435 |
+
box-shadow: 0 4px 12px rgba(255, 210, 30, 0.1);
|
| 436 |
+
}
|
| 437 |
+
|
| 438 |
+
.faq-item summary::-webkit-details-marker {
|
| 439 |
+
display: none;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
.faq-item summary::before {
|
| 443 |
+
content: '▶';
|
| 444 |
+
display: inline-block;
|
| 445 |
+
margin-right: 8px;
|
| 446 |
+
transition: transform 0.3s ease;
|
| 447 |
+
color: var(--accent-secondary);
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
.faq-item[open] summary::before {
|
| 451 |
+
transform: rotate(90deg);
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
.faq-item summary:hover {
|
| 455 |
+
color: var(--accent-primary) !important;
|
| 456 |
+
}
|
| 457 |
+
</style>
|
| 458 |
+
</div>
|
| 459 |
+
"""
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
# Column mapping for sorting
|
| 463 |
+
SORT_COLUMN_MAP = {
|
| 464 |
+
"Avg Action Completion": "Avg AC",
|
| 465 |
+
"Avg Tool Selection Quality": "Avg TSQ",
|
| 466 |
+
"Avg Session Cost": "Avg Total Cost",
|
| 467 |
+
}
|
krew_icon.png
ADDED
|
|
Git LFS Details
|
pyproject.toml
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
[tool.ruff]
|
| 2 |
-
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
|
| 3 |
-
select = ["E", "F"]
|
| 4 |
-
ignore = ["E501"] # line too long (black is taking care of this)
|
| 5 |
-
line-length = 119
|
| 6 |
-
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
|
| 7 |
-
|
| 8 |
-
[tool.isort]
|
| 9 |
-
profile = "black"
|
| 10 |
-
line_length = 119
|
| 11 |
-
|
| 12 |
-
[tool.black]
|
| 13 |
-
line-length = 119
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,16 +1,5 @@
|
|
| 1 |
-
|
| 2 |
-
black
|
| 3 |
-
datasets
|
| 4 |
-
gradio
|
| 5 |
-
gradio[oauth]
|
| 6 |
-
gradio_leaderboard==0.0.13
|
| 7 |
-
gradio_client
|
| 8 |
-
huggingface-hub>=0.18.0
|
| 9 |
-
matplotlib
|
| 10 |
-
numpy
|
| 11 |
pandas
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
tokenizers>=0.15.0
|
| 16 |
-
sentencepiece
|
|
|
|
| 1 |
+
gradio==5.35.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
pandas
|
| 3 |
+
matplotlib
|
| 4 |
+
plotly==5.24.1
|
| 5 |
+
pydantic==2.10.6
|
|
|
|
|
|
src/about.py
DELETED
|
@@ -1,72 +0,0 @@
|
|
| 1 |
-
from dataclasses import dataclass
|
| 2 |
-
from enum import Enum
|
| 3 |
-
|
| 4 |
-
@dataclass
|
| 5 |
-
class Task:
|
| 6 |
-
benchmark: str
|
| 7 |
-
metric: str
|
| 8 |
-
col_name: str
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
# Select your tasks here
|
| 12 |
-
# ---------------------------------------------------
|
| 13 |
-
class Tasks(Enum):
|
| 14 |
-
# task_key in the json file, metric_key in the json file, name to display in the leaderboard
|
| 15 |
-
task0 = Task("anli_r1", "acc", "ANLI")
|
| 16 |
-
task1 = Task("logiqa", "acc_norm", "LogiQA")
|
| 17 |
-
|
| 18 |
-
NUM_FEWSHOT = 0 # Change with your few shot
|
| 19 |
-
# ---------------------------------------------------
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
# Your leaderboard name
|
| 24 |
-
TITLE = """<h1 align="center" id="space-title">Demo leaderboard</h1>"""
|
| 25 |
-
|
| 26 |
-
# What does your leaderboard evaluate?
|
| 27 |
-
INTRODUCTION_TEXT = """
|
| 28 |
-
Intro text
|
| 29 |
-
"""
|
| 30 |
-
|
| 31 |
-
# Which evaluations are you running? how can people reproduce what you have?
|
| 32 |
-
LLM_BENCHMARKS_TEXT = f"""
|
| 33 |
-
## How it works
|
| 34 |
-
|
| 35 |
-
## Reproducibility
|
| 36 |
-
To reproduce our results, here is the commands you can run:
|
| 37 |
-
|
| 38 |
-
"""
|
| 39 |
-
|
| 40 |
-
EVALUATION_QUEUE_TEXT = """
|
| 41 |
-
## Some good practices before submitting a model
|
| 42 |
-
|
| 43 |
-
### 1) Make sure you can load your model and tokenizer using AutoClasses:
|
| 44 |
-
```python
|
| 45 |
-
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
| 46 |
-
config = AutoConfig.from_pretrained("your model name", revision=revision)
|
| 47 |
-
model = AutoModel.from_pretrained("your model name", revision=revision)
|
| 48 |
-
tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision)
|
| 49 |
-
```
|
| 50 |
-
If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded.
|
| 51 |
-
|
| 52 |
-
Note: make sure your model is public!
|
| 53 |
-
Note: if your model needs `use_remote_code=True`, we do not support this option yet but we are working on adding it, stay posted!
|
| 54 |
-
|
| 55 |
-
### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index)
|
| 56 |
-
It's a new format for storing weights which is safer and faster to load and use. It will also allow us to add the number of parameters of your model to the `Extended Viewer`!
|
| 57 |
-
|
| 58 |
-
### 3) Make sure your model has an open license!
|
| 59 |
-
This is a leaderboard for Open LLMs, and we'd love for as many people as possible to know they can use your model 🤗
|
| 60 |
-
|
| 61 |
-
### 4) Fill up your model card
|
| 62 |
-
When we add extra information about models to the leaderboard, it will be automatically taken from the model card
|
| 63 |
-
|
| 64 |
-
## In case of model failure
|
| 65 |
-
If your model is displayed in the `FAILED` category, its execution stopped.
|
| 66 |
-
Make sure you have followed the above steps first.
|
| 67 |
-
If everything is done, check you can launch the EleutherAIHarness on your model locally, using the above command without modifications (you can add `--limit` to limit the number of examples per task).
|
| 68 |
-
"""
|
| 69 |
-
|
| 70 |
-
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
| 71 |
-
CITATION_BUTTON_TEXT = r"""
|
| 72 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/display/css_html_js.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
| 1 |
-
custom_css = """
|
| 2 |
-
|
| 3 |
-
.markdown-text {
|
| 4 |
-
font-size: 16px !important;
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
#models-to-add-text {
|
| 8 |
-
font-size: 18px !important;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
#citation-button span {
|
| 12 |
-
font-size: 16px !important;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
#citation-button textarea {
|
| 16 |
-
font-size: 16px !important;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
#citation-button > label > button {
|
| 20 |
-
margin: 6px;
|
| 21 |
-
transform: scale(1.3);
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
#leaderboard-table {
|
| 25 |
-
margin-top: 15px
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
#leaderboard-table-lite {
|
| 29 |
-
margin-top: 15px
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
#search-bar-table-box > div:first-child {
|
| 33 |
-
background: none;
|
| 34 |
-
border: none;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
#search-bar {
|
| 38 |
-
padding: 0px;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
/* Limit the width of the first AutoEvalColumn so that names don't expand too much */
|
| 42 |
-
#leaderboard-table td:nth-child(2),
|
| 43 |
-
#leaderboard-table th:nth-child(2) {
|
| 44 |
-
max-width: 400px;
|
| 45 |
-
overflow: auto;
|
| 46 |
-
white-space: nowrap;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.tab-buttons button {
|
| 50 |
-
font-size: 20px;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
#scale-logo {
|
| 54 |
-
border-style: none !important;
|
| 55 |
-
box-shadow: none;
|
| 56 |
-
display: block;
|
| 57 |
-
margin-left: auto;
|
| 58 |
-
margin-right: auto;
|
| 59 |
-
max-width: 600px;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
#scale-logo .download {
|
| 63 |
-
display: none;
|
| 64 |
-
}
|
| 65 |
-
#filter_type{
|
| 66 |
-
border: 0;
|
| 67 |
-
padding-left: 0;
|
| 68 |
-
padding-top: 0;
|
| 69 |
-
}
|
| 70 |
-
#filter_type label {
|
| 71 |
-
display: flex;
|
| 72 |
-
}
|
| 73 |
-
#filter_type label > span{
|
| 74 |
-
margin-top: var(--spacing-lg);
|
| 75 |
-
margin-right: 0.5em;
|
| 76 |
-
}
|
| 77 |
-
#filter_type label > .wrap{
|
| 78 |
-
width: 103px;
|
| 79 |
-
}
|
| 80 |
-
#filter_type label > .wrap .wrap-inner{
|
| 81 |
-
padding: 2px;
|
| 82 |
-
}
|
| 83 |
-
#filter_type label > .wrap .wrap-inner input{
|
| 84 |
-
width: 1px
|
| 85 |
-
}
|
| 86 |
-
#filter-columns-type{
|
| 87 |
-
border:0;
|
| 88 |
-
padding:0.5;
|
| 89 |
-
}
|
| 90 |
-
#filter-columns-size{
|
| 91 |
-
border:0;
|
| 92 |
-
padding:0.5;
|
| 93 |
-
}
|
| 94 |
-
#box-filter > .form{
|
| 95 |
-
border: 0
|
| 96 |
-
}
|
| 97 |
-
"""
|
| 98 |
-
|
| 99 |
-
get_window_url_params = """
|
| 100 |
-
function(url_params) {
|
| 101 |
-
const params = new URLSearchParams(window.location.search);
|
| 102 |
-
url_params = Object.fromEntries(params);
|
| 103 |
-
return url_params;
|
| 104 |
-
}
|
| 105 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/display/formatting.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
def model_hyperlink(link, model_name):
|
| 2 |
-
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
def make_clickable_model(model_name):
|
| 6 |
-
link = f"https://huggingface.co/{model_name}"
|
| 7 |
-
return model_hyperlink(link, model_name)
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
def styled_error(error):
|
| 11 |
-
return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
def styled_warning(warn):
|
| 15 |
-
return f"<p style='color: orange; font-size: 20px; text-align: center;'>{warn}</p>"
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
def styled_message(message):
|
| 19 |
-
return f"<p style='color: green; font-size: 20px; text-align: center;'>{message}</p>"
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
def has_no_nan_values(df, columns):
|
| 23 |
-
return df[columns].notna().all(axis=1)
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
def has_nan_values(df, columns):
|
| 27 |
-
return df[columns].isna().any(axis=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/display/utils.py
DELETED
|
@@ -1,110 +0,0 @@
|
|
| 1 |
-
from dataclasses import dataclass, make_dataclass
|
| 2 |
-
from enum import Enum
|
| 3 |
-
|
| 4 |
-
import pandas as pd
|
| 5 |
-
|
| 6 |
-
from src.about import Tasks
|
| 7 |
-
|
| 8 |
-
def fields(raw_class):
|
| 9 |
-
return [v for k, v in raw_class.__dict__.items() if k[:2] != "__" and k[-2:] != "__"]
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
# These classes are for user facing column names,
|
| 13 |
-
# to avoid having to change them all around the code
|
| 14 |
-
# when a modif is needed
|
| 15 |
-
@dataclass
|
| 16 |
-
class ColumnContent:
|
| 17 |
-
name: str
|
| 18 |
-
type: str
|
| 19 |
-
displayed_by_default: bool
|
| 20 |
-
hidden: bool = False
|
| 21 |
-
never_hidden: bool = False
|
| 22 |
-
|
| 23 |
-
## Leaderboard columns
|
| 24 |
-
auto_eval_column_dict = []
|
| 25 |
-
# Init
|
| 26 |
-
auto_eval_column_dict.append(["model_type_symbol", ColumnContent, ColumnContent("T", "str", True, never_hidden=True)])
|
| 27 |
-
auto_eval_column_dict.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])
|
| 28 |
-
#Scores
|
| 29 |
-
auto_eval_column_dict.append(["average", ColumnContent, ColumnContent("Average ⬆️", "number", True)])
|
| 30 |
-
for task in Tasks:
|
| 31 |
-
auto_eval_column_dict.append([task.name, ColumnContent, ColumnContent(task.value.col_name, "number", True)])
|
| 32 |
-
# Model information
|
| 33 |
-
auto_eval_column_dict.append(["model_type", ColumnContent, ColumnContent("Type", "str", False)])
|
| 34 |
-
auto_eval_column_dict.append(["architecture", ColumnContent, ColumnContent("Architecture", "str", False)])
|
| 35 |
-
auto_eval_column_dict.append(["weight_type", ColumnContent, ColumnContent("Weight type", "str", False, True)])
|
| 36 |
-
auto_eval_column_dict.append(["precision", ColumnContent, ColumnContent("Precision", "str", False)])
|
| 37 |
-
auto_eval_column_dict.append(["license", ColumnContent, ColumnContent("Hub License", "str", False)])
|
| 38 |
-
auto_eval_column_dict.append(["params", ColumnContent, ColumnContent("#Params (B)", "number", False)])
|
| 39 |
-
auto_eval_column_dict.append(["likes", ColumnContent, ColumnContent("Hub ❤️", "number", False)])
|
| 40 |
-
auto_eval_column_dict.append(["still_on_hub", ColumnContent, ColumnContent("Available on the hub", "bool", False)])
|
| 41 |
-
auto_eval_column_dict.append(["revision", ColumnContent, ColumnContent("Model sha", "str", False, False)])
|
| 42 |
-
|
| 43 |
-
# We use make dataclass to dynamically fill the scores from Tasks
|
| 44 |
-
AutoEvalColumn = make_dataclass("AutoEvalColumn", auto_eval_column_dict, frozen=True)
|
| 45 |
-
|
| 46 |
-
## For the queue columns in the submission tab
|
| 47 |
-
@dataclass(frozen=True)
|
| 48 |
-
class EvalQueueColumn: # Queue column
|
| 49 |
-
model = ColumnContent("model", "markdown", True)
|
| 50 |
-
revision = ColumnContent("revision", "str", True)
|
| 51 |
-
private = ColumnContent("private", "bool", True)
|
| 52 |
-
precision = ColumnContent("precision", "str", True)
|
| 53 |
-
weight_type = ColumnContent("weight_type", "str", "Original")
|
| 54 |
-
status = ColumnContent("status", "str", True)
|
| 55 |
-
|
| 56 |
-
## All the model information that we might need
|
| 57 |
-
@dataclass
|
| 58 |
-
class ModelDetails:
|
| 59 |
-
name: str
|
| 60 |
-
display_name: str = ""
|
| 61 |
-
symbol: str = "" # emoji
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
class ModelType(Enum):
|
| 65 |
-
PT = ModelDetails(name="pretrained", symbol="🟢")
|
| 66 |
-
FT = ModelDetails(name="fine-tuned", symbol="🔶")
|
| 67 |
-
IFT = ModelDetails(name="instruction-tuned", symbol="⭕")
|
| 68 |
-
RL = ModelDetails(name="RL-tuned", symbol="🟦")
|
| 69 |
-
Unknown = ModelDetails(name="", symbol="?")
|
| 70 |
-
|
| 71 |
-
def to_str(self, separator=" "):
|
| 72 |
-
return f"{self.value.symbol}{separator}{self.value.name}"
|
| 73 |
-
|
| 74 |
-
@staticmethod
|
| 75 |
-
def from_str(type):
|
| 76 |
-
if "fine-tuned" in type or "🔶" in type:
|
| 77 |
-
return ModelType.FT
|
| 78 |
-
if "pretrained" in type or "🟢" in type:
|
| 79 |
-
return ModelType.PT
|
| 80 |
-
if "RL-tuned" in type or "🟦" in type:
|
| 81 |
-
return ModelType.RL
|
| 82 |
-
if "instruction-tuned" in type or "⭕" in type:
|
| 83 |
-
return ModelType.IFT
|
| 84 |
-
return ModelType.Unknown
|
| 85 |
-
|
| 86 |
-
class WeightType(Enum):
|
| 87 |
-
Adapter = ModelDetails("Adapter")
|
| 88 |
-
Original = ModelDetails("Original")
|
| 89 |
-
Delta = ModelDetails("Delta")
|
| 90 |
-
|
| 91 |
-
class Precision(Enum):
|
| 92 |
-
float16 = ModelDetails("float16")
|
| 93 |
-
bfloat16 = ModelDetails("bfloat16")
|
| 94 |
-
Unknown = ModelDetails("?")
|
| 95 |
-
|
| 96 |
-
def from_str(precision):
|
| 97 |
-
if precision in ["torch.float16", "float16"]:
|
| 98 |
-
return Precision.float16
|
| 99 |
-
if precision in ["torch.bfloat16", "bfloat16"]:
|
| 100 |
-
return Precision.bfloat16
|
| 101 |
-
return Precision.Unknown
|
| 102 |
-
|
| 103 |
-
# Column selection
|
| 104 |
-
COLS = [c.name for c in fields(AutoEvalColumn) if not c.hidden]
|
| 105 |
-
|
| 106 |
-
EVAL_COLS = [c.name for c in fields(EvalQueueColumn)]
|
| 107 |
-
EVAL_TYPES = [c.type for c in fields(EvalQueueColumn)]
|
| 108 |
-
|
| 109 |
-
BENCHMARK_COLS = [t.value.col_name for t in Tasks]
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/envs.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
|
| 3 |
-
from huggingface_hub import HfApi
|
| 4 |
-
|
| 5 |
-
# Info to change for your repository
|
| 6 |
-
# ----------------------------------
|
| 7 |
-
TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
|
| 8 |
-
|
| 9 |
-
OWNER = "demo-leaderboard-backend" # Change to your org - don't forget to create a results and request dataset, with the correct format!
|
| 10 |
-
# ----------------------------------
|
| 11 |
-
|
| 12 |
-
REPO_ID = f"{OWNER}/leaderboard"
|
| 13 |
-
QUEUE_REPO = f"{OWNER}/requests"
|
| 14 |
-
RESULTS_REPO = f"{OWNER}/results"
|
| 15 |
-
|
| 16 |
-
# If you setup a cache later, just change HF_HOME
|
| 17 |
-
CACHE_PATH=os.getenv("HF_HOME", ".")
|
| 18 |
-
|
| 19 |
-
# Local caches
|
| 20 |
-
EVAL_REQUESTS_PATH = os.path.join(CACHE_PATH, "eval-queue")
|
| 21 |
-
EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results")
|
| 22 |
-
EVAL_REQUESTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-queue-bk")
|
| 23 |
-
EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
|
| 24 |
-
|
| 25 |
-
API = HfApi(token=TOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/leaderboard/read_evals.py
DELETED
|
@@ -1,196 +0,0 @@
|
|
| 1 |
-
import glob
|
| 2 |
-
import json
|
| 3 |
-
import math
|
| 4 |
-
import os
|
| 5 |
-
from dataclasses import dataclass
|
| 6 |
-
|
| 7 |
-
import dateutil
|
| 8 |
-
import numpy as np
|
| 9 |
-
|
| 10 |
-
from src.display.formatting import make_clickable_model
|
| 11 |
-
from src.display.utils import AutoEvalColumn, ModelType, Tasks, Precision, WeightType
|
| 12 |
-
from src.submission.check_validity import is_model_on_hub
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
@dataclass
|
| 16 |
-
class EvalResult:
|
| 17 |
-
"""Represents one full evaluation. Built from a combination of the result and request file for a given run.
|
| 18 |
-
"""
|
| 19 |
-
eval_name: str # org_model_precision (uid)
|
| 20 |
-
full_model: str # org/model (path on hub)
|
| 21 |
-
org: str
|
| 22 |
-
model: str
|
| 23 |
-
revision: str # commit hash, "" if main
|
| 24 |
-
results: dict
|
| 25 |
-
precision: Precision = Precision.Unknown
|
| 26 |
-
model_type: ModelType = ModelType.Unknown # Pretrained, fine tuned, ...
|
| 27 |
-
weight_type: WeightType = WeightType.Original # Original or Adapter
|
| 28 |
-
architecture: str = "Unknown"
|
| 29 |
-
license: str = "?"
|
| 30 |
-
likes: int = 0
|
| 31 |
-
num_params: int = 0
|
| 32 |
-
date: str = "" # submission date of request file
|
| 33 |
-
still_on_hub: bool = False
|
| 34 |
-
|
| 35 |
-
@classmethod
|
| 36 |
-
def init_from_json_file(self, json_filepath):
|
| 37 |
-
"""Inits the result from the specific model result file"""
|
| 38 |
-
with open(json_filepath) as fp:
|
| 39 |
-
data = json.load(fp)
|
| 40 |
-
|
| 41 |
-
config = data.get("config")
|
| 42 |
-
|
| 43 |
-
# Precision
|
| 44 |
-
precision = Precision.from_str(config.get("model_dtype"))
|
| 45 |
-
|
| 46 |
-
# Get model and org
|
| 47 |
-
org_and_model = config.get("model_name", config.get("model_args", None))
|
| 48 |
-
org_and_model = org_and_model.split("/", 1)
|
| 49 |
-
|
| 50 |
-
if len(org_and_model) == 1:
|
| 51 |
-
org = None
|
| 52 |
-
model = org_and_model[0]
|
| 53 |
-
result_key = f"{model}_{precision.value.name}"
|
| 54 |
-
else:
|
| 55 |
-
org = org_and_model[0]
|
| 56 |
-
model = org_and_model[1]
|
| 57 |
-
result_key = f"{org}_{model}_{precision.value.name}"
|
| 58 |
-
full_model = "/".join(org_and_model)
|
| 59 |
-
|
| 60 |
-
still_on_hub, _, model_config = is_model_on_hub(
|
| 61 |
-
full_model, config.get("model_sha", "main"), trust_remote_code=True, test_tokenizer=False
|
| 62 |
-
)
|
| 63 |
-
architecture = "?"
|
| 64 |
-
if model_config is not None:
|
| 65 |
-
architectures = getattr(model_config, "architectures", None)
|
| 66 |
-
if architectures:
|
| 67 |
-
architecture = ";".join(architectures)
|
| 68 |
-
|
| 69 |
-
# Extract results available in this file (some results are split in several files)
|
| 70 |
-
results = {}
|
| 71 |
-
for task in Tasks:
|
| 72 |
-
task = task.value
|
| 73 |
-
|
| 74 |
-
# We average all scores of a given metric (not all metrics are present in all files)
|
| 75 |
-
accs = np.array([v.get(task.metric, None) for k, v in data["results"].items() if task.benchmark == k])
|
| 76 |
-
if accs.size == 0 or any([acc is None for acc in accs]):
|
| 77 |
-
continue
|
| 78 |
-
|
| 79 |
-
mean_acc = np.mean(accs) * 100.0
|
| 80 |
-
results[task.benchmark] = mean_acc
|
| 81 |
-
|
| 82 |
-
return self(
|
| 83 |
-
eval_name=result_key,
|
| 84 |
-
full_model=full_model,
|
| 85 |
-
org=org,
|
| 86 |
-
model=model,
|
| 87 |
-
results=results,
|
| 88 |
-
precision=precision,
|
| 89 |
-
revision= config.get("model_sha", ""),
|
| 90 |
-
still_on_hub=still_on_hub,
|
| 91 |
-
architecture=architecture
|
| 92 |
-
)
|
| 93 |
-
|
| 94 |
-
def update_with_request_file(self, requests_path):
|
| 95 |
-
"""Finds the relevant request file for the current model and updates info with it"""
|
| 96 |
-
request_file = get_request_file_for_model(requests_path, self.full_model, self.precision.value.name)
|
| 97 |
-
|
| 98 |
-
try:
|
| 99 |
-
with open(request_file, "r") as f:
|
| 100 |
-
request = json.load(f)
|
| 101 |
-
self.model_type = ModelType.from_str(request.get("model_type", ""))
|
| 102 |
-
self.weight_type = WeightType[request.get("weight_type", "Original")]
|
| 103 |
-
self.license = request.get("license", "?")
|
| 104 |
-
self.likes = request.get("likes", 0)
|
| 105 |
-
self.num_params = request.get("params", 0)
|
| 106 |
-
self.date = request.get("submitted_time", "")
|
| 107 |
-
except Exception:
|
| 108 |
-
print(f"Could not find request file for {self.org}/{self.model} with precision {self.precision.value.name}")
|
| 109 |
-
|
| 110 |
-
def to_dict(self):
|
| 111 |
-
"""Converts the Eval Result to a dict compatible with our dataframe display"""
|
| 112 |
-
average = sum([v for v in self.results.values() if v is not None]) / len(Tasks)
|
| 113 |
-
data_dict = {
|
| 114 |
-
"eval_name": self.eval_name, # not a column, just a save name,
|
| 115 |
-
AutoEvalColumn.precision.name: self.precision.value.name,
|
| 116 |
-
AutoEvalColumn.model_type.name: self.model_type.value.name,
|
| 117 |
-
AutoEvalColumn.model_type_symbol.name: self.model_type.value.symbol,
|
| 118 |
-
AutoEvalColumn.weight_type.name: self.weight_type.value.name,
|
| 119 |
-
AutoEvalColumn.architecture.name: self.architecture,
|
| 120 |
-
AutoEvalColumn.model.name: make_clickable_model(self.full_model),
|
| 121 |
-
AutoEvalColumn.revision.name: self.revision,
|
| 122 |
-
AutoEvalColumn.average.name: average,
|
| 123 |
-
AutoEvalColumn.license.name: self.license,
|
| 124 |
-
AutoEvalColumn.likes.name: self.likes,
|
| 125 |
-
AutoEvalColumn.params.name: self.num_params,
|
| 126 |
-
AutoEvalColumn.still_on_hub.name: self.still_on_hub,
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
for task in Tasks:
|
| 130 |
-
data_dict[task.value.col_name] = self.results[task.value.benchmark]
|
| 131 |
-
|
| 132 |
-
return data_dict
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
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 |
-
|
| 143 |
-
# Select correct request file (precision)
|
| 144 |
-
request_file = ""
|
| 145 |
-
request_files = sorted(request_files, reverse=True)
|
| 146 |
-
for tmp_request_file in request_files:
|
| 147 |
-
with open(tmp_request_file, "r") as f:
|
| 148 |
-
req_content = json.load(f)
|
| 149 |
-
if (
|
| 150 |
-
req_content["status"] in ["FINISHED"]
|
| 151 |
-
and req_content["precision"] == precision.split(".")[-1]
|
| 152 |
-
):
|
| 153 |
-
request_file = tmp_request_file
|
| 154 |
-
return request_file
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
def get_raw_eval_results(results_path: str, requests_path: str) -> list[EvalResult]:
|
| 158 |
-
"""From the path of the results folder root, extract all needed info for results"""
|
| 159 |
-
model_result_filepaths = []
|
| 160 |
-
|
| 161 |
-
for root, _, files in os.walk(results_path):
|
| 162 |
-
# We should only have json files in model results
|
| 163 |
-
if len(files) == 0 or any([not f.endswith(".json") for f in files]):
|
| 164 |
-
continue
|
| 165 |
-
|
| 166 |
-
# Sort the files by date
|
| 167 |
-
try:
|
| 168 |
-
files.sort(key=lambda x: x.removesuffix(".json").removeprefix("results_")[:-7])
|
| 169 |
-
except dateutil.parser._parser.ParserError:
|
| 170 |
-
files = [files[-1]]
|
| 171 |
-
|
| 172 |
-
for file in files:
|
| 173 |
-
model_result_filepaths.append(os.path.join(root, file))
|
| 174 |
-
|
| 175 |
-
eval_results = {}
|
| 176 |
-
for model_result_filepath in model_result_filepaths:
|
| 177 |
-
# Creation of result
|
| 178 |
-
eval_result = EvalResult.init_from_json_file(model_result_filepath)
|
| 179 |
-
eval_result.update_with_request_file(requests_path)
|
| 180 |
-
|
| 181 |
-
# Store results of same eval together
|
| 182 |
-
eval_name = eval_result.eval_name
|
| 183 |
-
if eval_name in eval_results.keys():
|
| 184 |
-
eval_results[eval_name].results.update({k: v for k, v in eval_result.results.items() if v is not None})
|
| 185 |
-
else:
|
| 186 |
-
eval_results[eval_name] = eval_result
|
| 187 |
-
|
| 188 |
-
results = []
|
| 189 |
-
for v in eval_results.values():
|
| 190 |
-
try:
|
| 191 |
-
v.to_dict() # we test if the dict version is complete
|
| 192 |
-
results.append(v)
|
| 193 |
-
except KeyError: # not all eval values present
|
| 194 |
-
continue
|
| 195 |
-
|
| 196 |
-
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/populate.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import os
|
| 3 |
-
|
| 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
|
| 8 |
-
from src.leaderboard.read_evals import get_raw_eval_results
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
| 12 |
-
"""Creates a dataframe from all the individual experiment results"""
|
| 13 |
-
raw_data = get_raw_eval_results(results_path, requests_path)
|
| 14 |
-
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
-
|
| 16 |
-
df = pd.DataFrame.from_records(all_data_json)
|
| 17 |
-
df = df.sort_values(by=[AutoEvalColumn.average.name], ascending=False)
|
| 18 |
-
df = df[cols].round(decimals=2)
|
| 19 |
-
|
| 20 |
-
# filter out if any of the benchmarks have not been produced
|
| 21 |
-
df = df[has_no_nan_values(df, benchmark_cols)]
|
| 22 |
-
return df
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
def get_evaluation_queue_df(save_path: str, cols: list) -> list[pd.DataFrame]:
|
| 26 |
-
"""Creates the different dataframes for the evaluation queues requestes"""
|
| 27 |
-
entries = [entry for entry in os.listdir(save_path) if not entry.startswith(".")]
|
| 28 |
-
all_evals = []
|
| 29 |
-
|
| 30 |
-
for entry in entries:
|
| 31 |
-
if ".json" in entry:
|
| 32 |
-
file_path = os.path.join(save_path, entry)
|
| 33 |
-
with open(file_path) as fp:
|
| 34 |
-
data = json.load(fp)
|
| 35 |
-
|
| 36 |
-
data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
|
| 37 |
-
data[EvalQueueColumn.revision.name] = data.get("revision", "main")
|
| 38 |
-
|
| 39 |
-
all_evals.append(data)
|
| 40 |
-
elif ".md" not in entry:
|
| 41 |
-
# this is a folder
|
| 42 |
-
sub_entries = [e for e in os.listdir(f"{save_path}/{entry}") if os.path.isfile(e) and not e.startswith(".")]
|
| 43 |
-
for sub_entry in sub_entries:
|
| 44 |
-
file_path = os.path.join(save_path, entry, sub_entry)
|
| 45 |
-
with open(file_path) as fp:
|
| 46 |
-
data = json.load(fp)
|
| 47 |
-
|
| 48 |
-
data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
|
| 49 |
-
data[EvalQueueColumn.revision.name] = data.get("revision", "main")
|
| 50 |
-
all_evals.append(data)
|
| 51 |
-
|
| 52 |
-
pending_list = [e for e in all_evals if e["status"] in ["PENDING", "RERUN"]]
|
| 53 |
-
running_list = [e for e in all_evals if e["status"] == "RUNNING"]
|
| 54 |
-
finished_list = [e for e in all_evals if e["status"].startswith("FINISHED") or e["status"] == "PENDING_NEW_EVAL"]
|
| 55 |
-
df_pending = pd.DataFrame.from_records(pending_list, columns=cols)
|
| 56 |
-
df_running = pd.DataFrame.from_records(running_list, columns=cols)
|
| 57 |
-
df_finished = pd.DataFrame.from_records(finished_list, columns=cols)
|
| 58 |
-
return df_finished[cols], df_running[cols], df_pending[cols]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/submission/check_validity.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import os
|
| 3 |
-
import re
|
| 4 |
-
from collections import defaultdict
|
| 5 |
-
from datetime import datetime, timedelta, timezone
|
| 6 |
-
|
| 7 |
-
import huggingface_hub
|
| 8 |
-
from huggingface_hub import ModelCard
|
| 9 |
-
from huggingface_hub.hf_api import ModelInfo
|
| 10 |
-
from transformers import AutoConfig
|
| 11 |
-
from transformers.models.auto.tokenization_auto import AutoTokenizer
|
| 12 |
-
|
| 13 |
-
def check_model_card(repo_id: str) -> tuple[bool, str]:
|
| 14 |
-
"""Checks if the model card and license exist and have been filled"""
|
| 15 |
-
try:
|
| 16 |
-
card = ModelCard.load(repo_id)
|
| 17 |
-
except huggingface_hub.utils.EntryNotFoundError:
|
| 18 |
-
return False, "Please add a model card to your model to explain how you trained/fine-tuned it."
|
| 19 |
-
|
| 20 |
-
# Enforce license metadata
|
| 21 |
-
if card.data.license is None:
|
| 22 |
-
if not ("license_name" in card.data and "license_link" in card.data):
|
| 23 |
-
return False, (
|
| 24 |
-
"License not found. Please add a license to your model card using the `license` metadata or a"
|
| 25 |
-
" `license_name`/`license_link` pair."
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
# Enforce card content
|
| 29 |
-
if len(card.text) < 200:
|
| 30 |
-
return False, "Please add a description to your model card, it is too short."
|
| 31 |
-
|
| 32 |
-
return True, ""
|
| 33 |
-
|
| 34 |
-
def is_model_on_hub(model_name: str, revision: str, token: str = None, trust_remote_code=False, test_tokenizer=False) -> tuple[bool, str]:
|
| 35 |
-
"""Checks if the model model_name is on the hub, and whether it (and its tokenizer) can be loaded with AutoClasses."""
|
| 36 |
-
try:
|
| 37 |
-
config = AutoConfig.from_pretrained(model_name, revision=revision, trust_remote_code=trust_remote_code, token=token)
|
| 38 |
-
if test_tokenizer:
|
| 39 |
-
try:
|
| 40 |
-
tk = AutoTokenizer.from_pretrained(model_name, revision=revision, trust_remote_code=trust_remote_code, token=token)
|
| 41 |
-
except ValueError as e:
|
| 42 |
-
return (
|
| 43 |
-
False,
|
| 44 |
-
f"uses a tokenizer which is not in a transformers release: {e}",
|
| 45 |
-
None
|
| 46 |
-
)
|
| 47 |
-
except Exception as e:
|
| 48 |
-
return (False, "'s tokenizer cannot be loaded. Is your tokenizer class in a stable transformers release, and correctly configured?", None)
|
| 49 |
-
return True, None, config
|
| 50 |
-
|
| 51 |
-
except ValueError:
|
| 52 |
-
return (
|
| 53 |
-
False,
|
| 54 |
-
"needs to be launched with `trust_remote_code=True`. For safety reason, we do not allow these models to be automatically submitted to the leaderboard.",
|
| 55 |
-
None
|
| 56 |
-
)
|
| 57 |
-
|
| 58 |
-
except Exception as e:
|
| 59 |
-
return False, "was not found on hub!", None
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
def get_model_size(model_info: ModelInfo, precision: str):
|
| 63 |
-
"""Gets the model size from the configuration, or the model name if the configuration does not contain the information."""
|
| 64 |
-
try:
|
| 65 |
-
model_size = round(model_info.safetensors["total"] / 1e9, 3)
|
| 66 |
-
except (AttributeError, TypeError):
|
| 67 |
-
return 0 # Unknown model sizes are indicated as 0, see NUMERIC_INTERVALS in app.py
|
| 68 |
-
|
| 69 |
-
size_factor = 8 if (precision == "GPTQ" or "gptq" in model_info.modelId.lower()) else 1
|
| 70 |
-
model_size = size_factor * model_size
|
| 71 |
-
return model_size
|
| 72 |
-
|
| 73 |
-
def get_model_arch(model_info: ModelInfo):
|
| 74 |
-
"""Gets the model architecture from the configuration"""
|
| 75 |
-
return model_info.config.get("architectures", "Unknown")
|
| 76 |
-
|
| 77 |
-
def already_submitted_models(requested_models_dir: str) -> set[str]:
|
| 78 |
-
"""Gather a list of already submitted models to avoid duplicates"""
|
| 79 |
-
depth = 1
|
| 80 |
-
file_names = []
|
| 81 |
-
users_to_submission_dates = defaultdict(list)
|
| 82 |
-
|
| 83 |
-
for root, _, files in os.walk(requested_models_dir):
|
| 84 |
-
current_depth = root.count(os.sep) - requested_models_dir.count(os.sep)
|
| 85 |
-
if current_depth == depth:
|
| 86 |
-
for file in files:
|
| 87 |
-
if not file.endswith(".json"):
|
| 88 |
-
continue
|
| 89 |
-
with open(os.path.join(root, file), "r") as f:
|
| 90 |
-
info = json.load(f)
|
| 91 |
-
file_names.append(f"{info['model']}_{info['revision']}_{info['precision']}")
|
| 92 |
-
|
| 93 |
-
# Select organisation
|
| 94 |
-
if info["model"].count("/") == 0 or "submitted_time" not in info:
|
| 95 |
-
continue
|
| 96 |
-
organisation, _ = info["model"].split("/")
|
| 97 |
-
users_to_submission_dates[organisation].append(info["submitted_time"])
|
| 98 |
-
|
| 99 |
-
return set(file_names), users_to_submission_dates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/submission/submit.py
DELETED
|
@@ -1,119 +0,0 @@
|
|
| 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
|
| 7 |
-
from src.submission.check_validity import (
|
| 8 |
-
already_submitted_models,
|
| 9 |
-
check_model_card,
|
| 10 |
-
get_model_size,
|
| 11 |
-
is_model_on_hub,
|
| 12 |
-
)
|
| 13 |
-
|
| 14 |
-
REQUESTED_MODELS = None
|
| 15 |
-
USERS_TO_SUBMISSION_DATES = None
|
| 16 |
-
|
| 17 |
-
def add_new_eval(
|
| 18 |
-
model: str,
|
| 19 |
-
base_model: str,
|
| 20 |
-
revision: str,
|
| 21 |
-
precision: str,
|
| 22 |
-
weight_type: str,
|
| 23 |
-
model_type: str,
|
| 24 |
-
):
|
| 25 |
-
global REQUESTED_MODELS
|
| 26 |
-
global USERS_TO_SUBMISSION_DATES
|
| 27 |
-
if not REQUESTED_MODELS:
|
| 28 |
-
REQUESTED_MODELS, USERS_TO_SUBMISSION_DATES = already_submitted_models(EVAL_REQUESTS_PATH)
|
| 29 |
-
|
| 30 |
-
user_name = ""
|
| 31 |
-
model_path = model
|
| 32 |
-
if "/" in model:
|
| 33 |
-
user_name = model.split("/")[0]
|
| 34 |
-
model_path = model.split("/")[1]
|
| 35 |
-
|
| 36 |
-
precision = precision.split(" ")[0]
|
| 37 |
-
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 38 |
-
|
| 39 |
-
if model_type is None or model_type == "":
|
| 40 |
-
return styled_error("Please select a model type.")
|
| 41 |
-
|
| 42 |
-
# Does the model actually exist?
|
| 43 |
-
if revision == "":
|
| 44 |
-
revision = "main"
|
| 45 |
-
|
| 46 |
-
# Is the model on the hub?
|
| 47 |
-
if weight_type in ["Delta", "Adapter"]:
|
| 48 |
-
base_model_on_hub, error, _ = is_model_on_hub(model_name=base_model, revision=revision, token=TOKEN, test_tokenizer=True)
|
| 49 |
-
if not base_model_on_hub:
|
| 50 |
-
return styled_error(f'Base model "{base_model}" {error}')
|
| 51 |
-
|
| 52 |
-
if not weight_type == "Adapter":
|
| 53 |
-
model_on_hub, error, _ = is_model_on_hub(model_name=model, revision=revision, token=TOKEN, test_tokenizer=True)
|
| 54 |
-
if not model_on_hub:
|
| 55 |
-
return styled_error(f'Model "{model}" {error}')
|
| 56 |
-
|
| 57 |
-
# Is the model info correctly filled?
|
| 58 |
-
try:
|
| 59 |
-
model_info = API.model_info(repo_id=model, revision=revision)
|
| 60 |
-
except Exception:
|
| 61 |
-
return styled_error("Could not get your model information. Please fill it up properly.")
|
| 62 |
-
|
| 63 |
-
model_size = get_model_size(model_info=model_info, precision=precision)
|
| 64 |
-
|
| 65 |
-
# Were the model card and license filled?
|
| 66 |
-
try:
|
| 67 |
-
license = model_info.cardData["license"]
|
| 68 |
-
except Exception:
|
| 69 |
-
return styled_error("Please select a license for your model")
|
| 70 |
-
|
| 71 |
-
modelcard_OK, error_msg = check_model_card(model)
|
| 72 |
-
if not modelcard_OK:
|
| 73 |
-
return styled_error(error_msg)
|
| 74 |
-
|
| 75 |
-
# Seems good, creating the eval
|
| 76 |
-
print("Adding new eval")
|
| 77 |
-
|
| 78 |
-
eval_entry = {
|
| 79 |
-
"model": model,
|
| 80 |
-
"base_model": base_model,
|
| 81 |
-
"revision": revision,
|
| 82 |
-
"precision": precision,
|
| 83 |
-
"weight_type": weight_type,
|
| 84 |
-
"status": "PENDING",
|
| 85 |
-
"submitted_time": current_time,
|
| 86 |
-
"model_type": model_type,
|
| 87 |
-
"likes": model_info.likes,
|
| 88 |
-
"params": model_size,
|
| 89 |
-
"license": license,
|
| 90 |
-
"private": False,
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
# Check for duplicate submission
|
| 94 |
-
if f"{model}_{revision}_{precision}" in REQUESTED_MODELS:
|
| 95 |
-
return styled_warning("This model has been already submitted.")
|
| 96 |
-
|
| 97 |
-
print("Creating eval file")
|
| 98 |
-
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{user_name}"
|
| 99 |
-
os.makedirs(OUT_DIR, exist_ok=True)
|
| 100 |
-
out_path = f"{OUT_DIR}/{model_path}_eval_request_False_{precision}_{weight_type}.json"
|
| 101 |
-
|
| 102 |
-
with open(out_path, "w") as f:
|
| 103 |
-
f.write(json.dumps(eval_entry))
|
| 104 |
-
|
| 105 |
-
print("Uploading eval file")
|
| 106 |
-
API.upload_file(
|
| 107 |
-
path_or_fileobj=out_path,
|
| 108 |
-
path_in_repo=out_path.split("eval-queue/")[1],
|
| 109 |
-
repo_id=QUEUE_REPO,
|
| 110 |
-
repo_type="dataset",
|
| 111 |
-
commit_message=f"Add {model} to eval queue",
|
| 112 |
-
)
|
| 113 |
-
|
| 114 |
-
# Remove the local file
|
| 115 |
-
os.remove(out_path)
|
| 116 |
-
|
| 117 |
-
return styled_message(
|
| 118 |
-
"Your request has been submitted to the evaluation queue!\nPlease wait for up to an hour for the model to show in the PENDING list."
|
| 119 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
styles/__init__.py
ADDED
|
File without changes
|
styles/leaderboard_styles.py
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
CSS styles for the Agent Leaderboard v2
|
| 3 |
+
This file contains all the styling that doesn't change frequently
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
def get_leaderboard_css():
|
| 7 |
+
"""Return the complete CSS for the leaderboard"""
|
| 8 |
+
return """
|
| 9 |
+
<style>
|
| 10 |
+
/* Import Geist fonts */
|
| 11 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
| 12 |
+
|
| 13 |
+
@font-face {
|
| 14 |
+
font-family: 'Geist';
|
| 15 |
+
src: url('https://raw.githubusercontent.com/vercel/geist-font/main/packages/next/dist/fonts/geist-sans/Geist-Variable.woff2') format('woff2');
|
| 16 |
+
font-weight: 100 900;
|
| 17 |
+
font-style: normal;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
@font-face {
|
| 21 |
+
font-family: 'Geist Mono';
|
| 22 |
+
src: url('https://raw.githubusercontent.com/vercel/geist-font/main/packages/next/dist/fonts/geist-mono/GeistMono-Variable.woff2') format('woff2');
|
| 23 |
+
font-weight: 100 900;
|
| 24 |
+
font-style: normal;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
/* Root variables for enhanced color scheme */
|
| 28 |
+
:root {
|
| 29 |
+
--bg-primary: #01091A;
|
| 30 |
+
--bg-secondary: rgba(245, 246, 247, 0.03);
|
| 31 |
+
--bg-card: rgba(245, 246, 247, 0.02);
|
| 32 |
+
--border-subtle: rgba(245, 246, 247, 0.08);
|
| 33 |
+
--border-default: rgba(245, 246, 247, 0.12);
|
| 34 |
+
--border-strong: rgba(245, 246, 247, 0.2);
|
| 35 |
+
--text-primary: #F5F6F7;
|
| 36 |
+
--text-secondary: #94A3B8;
|
| 37 |
+
--text-muted: #64748B;
|
| 38 |
+
--accent-primary: #ffd21e;
|
| 39 |
+
--accent-secondary: #1098F7;
|
| 40 |
+
--accent-tertiary: #F5F6F7;
|
| 41 |
+
--glow-primary: rgba(255, 210, 30, 0.4);
|
| 42 |
+
--glow-secondary: rgba(16, 152, 247, 0.4);
|
| 43 |
+
--glow-tertiary: rgba(245, 246, 247, 0.3);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/* Global font and background */
|
| 47 |
+
.gradio-container {
|
| 48 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif !important;
|
| 49 |
+
background: var(--bg-primary) !important;
|
| 50 |
+
color: var(--text-primary) !important;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/* Headers and text */
|
| 54 |
+
h1, h2, h3, h4 {
|
| 55 |
+
color: var(--text-primary) !important;
|
| 56 |
+
font-weight: 700 !important;
|
| 57 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
p, span, div {
|
| 61 |
+
color: var(--text-primary) !important;
|
| 62 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/* Labels and info text */
|
| 66 |
+
label {
|
| 67 |
+
color: var(--text-primary) !important;
|
| 68 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.gr-box label {
|
| 72 |
+
color: var(--text-primary) !important;
|
| 73 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.gr-info {
|
| 77 |
+
color: var(--text-secondary) !important;
|
| 78 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/* Simple metric cards */
|
| 82 |
+
.metric-card {
|
| 83 |
+
background: var(--bg-card);
|
| 84 |
+
border-radius: 16px;
|
| 85 |
+
padding: 24px;
|
| 86 |
+
position: relative;
|
| 87 |
+
border: 1px solid var(--border-subtle);
|
| 88 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.metric-card:hover {
|
| 92 |
+
transform: translateY(-4px);
|
| 93 |
+
border-color: var(--accent-primary);
|
| 94 |
+
box-shadow: 0 8px 24px rgba(255, 210, 30, 0.2);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/* Metric icon with glow effect */
|
| 98 |
+
.metric-icon {
|
| 99 |
+
width: 48px;
|
| 100 |
+
height: 48px;
|
| 101 |
+
display: flex;
|
| 102 |
+
align-items: center;
|
| 103 |
+
justify-content: center;
|
| 104 |
+
font-size: 2rem;
|
| 105 |
+
margin-bottom: 16px;
|
| 106 |
+
filter: drop-shadow(0 0 20px currentColor);
|
| 107 |
+
transition: all 0.3s ease;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.metric-card:hover .metric-icon {
|
| 111 |
+
transform: scale(1.1);
|
| 112 |
+
filter: drop-shadow(0 0 30px currentColor);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/* Table with tooltips */
|
| 116 |
+
.v2-styled-table th {
|
| 117 |
+
position: relative;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
.tooltip-trigger {
|
| 121 |
+
cursor: help;
|
| 122 |
+
text-decoration: underline;
|
| 123 |
+
text-decoration-style: dotted;
|
| 124 |
+
text-underline-offset: 2px;
|
| 125 |
+
text-decoration-color: var(--accent-secondary);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.tooltip-content {
|
| 129 |
+
display: none;
|
| 130 |
+
position: absolute;
|
| 131 |
+
bottom: 100%;
|
| 132 |
+
left: 50%;
|
| 133 |
+
transform: translateX(-50%);
|
| 134 |
+
background: var(--bg-primary);
|
| 135 |
+
border: 1px solid var(--border-default);
|
| 136 |
+
border-radius: 8px;
|
| 137 |
+
padding: 12px;
|
| 138 |
+
max-width: 300px;
|
| 139 |
+
font-size: 0.85rem;
|
| 140 |
+
color: var(--text-secondary);
|
| 141 |
+
z-index: 1000;
|
| 142 |
+
white-space: normal;
|
| 143 |
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
|
| 144 |
+
margin-bottom: 8px;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.tooltip-trigger:hover .tooltip-content {
|
| 148 |
+
display: block;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/* Enhanced radio buttons with primary accent */
|
| 152 |
+
input[type="radio"] {
|
| 153 |
+
background-color: var(--bg-secondary) !important;
|
| 154 |
+
border-color: var(--border-default) !important;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
input[type="radio"]:checked {
|
| 158 |
+
background-color: var(--accent-primary) !important;
|
| 159 |
+
border-color: var(--accent-primary) !important;
|
| 160 |
+
box-shadow: 0 0 10px var(--glow-primary) !important;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/* Enhanced dropdown styling */
|
| 164 |
+
.dropdown {
|
| 165 |
+
border-color: var(--border-default) !important;
|
| 166 |
+
background: var(--bg-card) !important;
|
| 167 |
+
color: var(--text-primary) !important;
|
| 168 |
+
transition: all 0.2s ease !important;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.dropdown:hover {
|
| 172 |
+
border-color: var(--accent-primary) !important;
|
| 173 |
+
box-shadow: 0 0 15px var(--glow-primary) !important;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
/* Enhanced table styling */
|
| 177 |
+
.dataframe {
|
| 178 |
+
background: var(--bg-card) !important;
|
| 179 |
+
border-radius: 16px !important;
|
| 180 |
+
overflow: hidden !important;
|
| 181 |
+
border: 1px solid var(--border-subtle) !important;
|
| 182 |
+
font-size: 15px !important;
|
| 183 |
+
max-height: 600px !important;
|
| 184 |
+
overflow-y: auto !important;
|
| 185 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 186 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/* Button styling */
|
| 190 |
+
button {
|
| 191 |
+
background: var(--bg-card) !important;
|
| 192 |
+
color: var(--text-primary) !important;
|
| 193 |
+
border: 1px solid var(--border-default) !important;
|
| 194 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
button:hover {
|
| 198 |
+
transform: translateY(-2px) !important;
|
| 199 |
+
border-color: var(--accent-primary) !important;
|
| 200 |
+
box-shadow: 0 4px 16px rgba(255, 210, 30, 0.2) !important;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/* Info boxes */
|
| 204 |
+
.info-box {
|
| 205 |
+
background: var(--bg-card);
|
| 206 |
+
border: 1px solid var(--border-subtle);
|
| 207 |
+
border-radius: 12px;
|
| 208 |
+
padding: 20px;
|
| 209 |
+
margin: 8px 0;
|
| 210 |
+
backdrop-filter: blur(10px);
|
| 211 |
+
position: relative;
|
| 212 |
+
overflow: hidden;
|
| 213 |
+
transition: all 0.3s ease;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.info-box:hover {
|
| 217 |
+
border-color: var(--accent-primary);
|
| 218 |
+
box-shadow: 0 4px 20px var(--glow-primary);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
/* Dark containers */
|
| 222 |
+
.dark-container {
|
| 223 |
+
background: var(--bg-card);
|
| 224 |
+
border: 1px solid var(--border-subtle);
|
| 225 |
+
border-radius: 20px;
|
| 226 |
+
padding: 28px;
|
| 227 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
| 228 |
+
backdrop-filter: blur(10px);
|
| 229 |
+
position: relative;
|
| 230 |
+
overflow: hidden;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/* Section headers */
|
| 234 |
+
.section-header {
|
| 235 |
+
display: flex;
|
| 236 |
+
align-items: center;
|
| 237 |
+
gap: 12px;
|
| 238 |
+
margin-bottom: 24px;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.section-icon {
|
| 242 |
+
filter: drop-shadow(0 0 12px currentColor);
|
| 243 |
+
transition: all 0.3s ease;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/* Scrollbar styling */
|
| 247 |
+
::-webkit-scrollbar {
|
| 248 |
+
width: 8px;
|
| 249 |
+
height: 8px;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
::-webkit-scrollbar-track {
|
| 253 |
+
background: var(--bg-secondary);
|
| 254 |
+
border-radius: 4px;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
::-webkit-scrollbar-thumb {
|
| 258 |
+
background: var(--accent-secondary);
|
| 259 |
+
border-radius: 4px;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
::-webkit-scrollbar-thumb:hover {
|
| 263 |
+
background: var(--accent-primary);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
/* Pulse animation */
|
| 267 |
+
@keyframes pulse-glow {
|
| 268 |
+
0% { box-shadow: 0 0 0 0 var(--glow-primary); }
|
| 269 |
+
70% { box-shadow: 0 0 0 10px transparent; }
|
| 270 |
+
100% { box-shadow: 0 0 0 0 transparent; }
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
.pulse {
|
| 274 |
+
animation: pulse-glow 2s infinite;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
/* Chart containers */
|
| 278 |
+
.chart-container {
|
| 279 |
+
display: flex;
|
| 280 |
+
justify-content: center;
|
| 281 |
+
align-items: center;
|
| 282 |
+
width: 100%;
|
| 283 |
+
margin: 0 auto;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
.chart-container > div {
|
| 287 |
+
width: 100%;
|
| 288 |
+
max-width: 1400px;
|
| 289 |
+
margin: 0 auto;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
/* Radar chart - remove all boundaries */
|
| 293 |
+
.radar-chart-container {
|
| 294 |
+
width: fit-content !important;
|
| 295 |
+
margin: 0 auto !important;
|
| 296 |
+
padding: 0 !important;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
.radar-chart-container > div,
|
| 300 |
+
.radar-chart,
|
| 301 |
+
.radar-chart .gradio-plot {
|
| 302 |
+
width: fit-content !important;
|
| 303 |
+
max-width: none !important;
|
| 304 |
+
margin: 0 auto !important;
|
| 305 |
+
padding: 0 !important;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
/* Grid layouts for cards */
|
| 310 |
+
.insight-card-grid {
|
| 311 |
+
display: grid;
|
| 312 |
+
grid-template-columns: repeat(5, 1fr);
|
| 313 |
+
gap: 16px;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.metric-card-grid {
|
| 317 |
+
display: grid;
|
| 318 |
+
grid-template-columns: repeat(3, 1fr);
|
| 319 |
+
gap: 16px;
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
/* Custom button container */
|
| 323 |
+
.custom-button-container {
|
| 324 |
+
text-align: center;
|
| 325 |
+
padding: 20px 0 10px 0;
|
| 326 |
+
margin-bottom: 10px;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
.header-action-button {
|
| 330 |
+
display: inline-block !important;
|
| 331 |
+
padding: 14px 28px !important;
|
| 332 |
+
background: #ffd21e !important;
|
| 333 |
+
color: #FFFFFF !important;
|
| 334 |
+
text-decoration: none !important;
|
| 335 |
+
border-radius: 16px !important;
|
| 336 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 337 |
+
font-weight: 700 !important;
|
| 338 |
+
font-size: 1.1rem !important;
|
| 339 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 340 |
+
border: none !important;
|
| 341 |
+
cursor: pointer !important;
|
| 342 |
+
box-shadow: 0 8px 24px rgba(255, 210, 30, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
|
| 343 |
+
position: relative !important;
|
| 344 |
+
overflow: hidden !important;
|
| 345 |
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35) !important;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
.header-action-button:hover {
|
| 349 |
+
transform: translateY(-3px) !important;
|
| 350 |
+
box-shadow: 0 12px 32px rgba(255, 210, 30, 0.5), 0 8px 16px rgba(0, 0, 0, 0.4) !important;
|
| 351 |
+
background: #ffd21e !important;
|
| 352 |
+
color: #FFFFFF !important;
|
| 353 |
+
text-decoration: none !important;
|
| 354 |
+
text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45) !important;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
/* Navigation buttons */
|
| 358 |
+
.nav-buttons-container {
|
| 359 |
+
display: flex;
|
| 360 |
+
justify-content: center;
|
| 361 |
+
align-items: center;
|
| 362 |
+
gap: 16px;
|
| 363 |
+
flex-wrap: wrap;
|
| 364 |
+
margin: 24px 0;
|
| 365 |
+
padding: 0 20px;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
.nav-link-button {
|
| 369 |
+
display: inline-flex !important;
|
| 370 |
+
align-items: center !important;
|
| 371 |
+
gap: 8px !important;
|
| 372 |
+
padding: 12px 20px !important;
|
| 373 |
+
background: rgba(1, 9, 26, 0.8) !important;
|
| 374 |
+
color: #F5F6F7 !important;
|
| 375 |
+
text-decoration: none !important;
|
| 376 |
+
border-radius: 12px !important;
|
| 377 |
+
font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 378 |
+
font-weight: 600 !important;
|
| 379 |
+
font-size: 0.95rem !important;
|
| 380 |
+
transition: all 0.3s ease !important;
|
| 381 |
+
border: 2px solid rgba(245, 246, 247, 0.15) !important;
|
| 382 |
+
backdrop-filter: blur(10px) !important;
|
| 383 |
+
-webkit-backdrop-filter: blur(10px) !important;
|
| 384 |
+
position: relative !important;
|
| 385 |
+
overflow: hidden !important;
|
| 386 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
.nav-link-button:hover {
|
| 390 |
+
transform: translateY(-3px) scale(1.02) !important;
|
| 391 |
+
border-color: #ffd21e !important;
|
| 392 |
+
box-shadow: 0 8px 24px rgba(255, 210, 30, 0.3), 0 4px 12px rgba(0, 0, 0, 0.4) !important;
|
| 393 |
+
text-decoration: none !important;
|
| 394 |
+
color: #FFFFFF !important;
|
| 395 |
+
}
|
| 396 |
+
</style>
|
| 397 |
+
"""
|
tabs/leaderboard_v1.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
utils.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def get_chart_colors():
|
| 2 |
+
# if is_dark_theme():
|
| 3 |
+
# return {
|
| 4 |
+
# "Private": "#60A5FA", # accent-blue
|
| 5 |
+
# "Open source": "#A78BFA", # accent-purple
|
| 6 |
+
# "performance_bands": ["#DCFCE7", "#FEF9C3", "#FEE2E2"],
|
| 7 |
+
# "text": "#FFFFFF",
|
| 8 |
+
# "background": "#1a1b1e",
|
| 9 |
+
# "grid": (1, 1, 1, 0.1), # RGBA tuple for grid
|
| 10 |
+
# }
|
| 11 |
+
return {
|
| 12 |
+
"Private": "#3F78FA", # accent-blue light
|
| 13 |
+
"Open source": "#A13AE2", # accent-purple light
|
| 14 |
+
"performance_bands": ["#DCFCE7", "#FEF9C3", "#FEE2E2"],
|
| 15 |
+
"text": "#111827",
|
| 16 |
+
"background": "#FFFFFF",
|
| 17 |
+
"grid": (0, 0, 0, 0.1), # RGBA tuple for grid
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def get_rank_badge(rank):
|
| 22 |
+
"""Generate HTML for rank badge with appropriate styling"""
|
| 23 |
+
badge_styles = {
|
| 24 |
+
1: ("1st", "linear-gradient(145deg, #ffd700, #ffc400)", "#000"),
|
| 25 |
+
2: ("2nd", "linear-gradient(145deg, #9ca3af, #787C7E)", "#fff"),
|
| 26 |
+
3: ("3rd", "linear-gradient(145deg, #CD7F32, #b36a1d)", "#fff"),
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
if rank in badge_styles:
|
| 30 |
+
label, gradient, text_color = badge_styles[rank]
|
| 31 |
+
return f"""
|
| 32 |
+
<div style="
|
| 33 |
+
display: inline-flex;
|
| 34 |
+
align-items: center;
|
| 35 |
+
justify-content: center;
|
| 36 |
+
min-width: 48px;
|
| 37 |
+
padding: 4px 12px;
|
| 38 |
+
background: {gradient};
|
| 39 |
+
color: {text_color};
|
| 40 |
+
border-radius: 6px;
|
| 41 |
+
font-weight: 600;
|
| 42 |
+
font-size: 0.9em;
|
| 43 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 44 |
+
">
|
| 45 |
+
{label}
|
| 46 |
+
</div>
|
| 47 |
+
"""
|
| 48 |
+
return f"""
|
| 49 |
+
<div style="
|
| 50 |
+
display: inline-flex;
|
| 51 |
+
align-items: center;
|
| 52 |
+
justify-content: center;
|
| 53 |
+
min-width: 28px;
|
| 54 |
+
color: #a1a1aa;
|
| 55 |
+
font-weight: 500;
|
| 56 |
+
">
|
| 57 |
+
{rank}
|
| 58 |
+
</div>
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def get_type_badge(model_type):
|
| 63 |
+
"""Generate HTML for model type badge"""
|
| 64 |
+
colors = get_chart_colors()
|
| 65 |
+
color_map = {
|
| 66 |
+
"Open source": colors.get("Open source", "#A13AE2"),
|
| 67 |
+
"Proprietary": colors.get("Private", "#3F78FA"),
|
| 68 |
+
"Private": colors.get("Private", "#3F78FA"),
|
| 69 |
+
}
|
| 70 |
+
label_map = {
|
| 71 |
+
"Open source": "OSS",
|
| 72 |
+
"Proprietary": "API",
|
| 73 |
+
"Private": "API",
|
| 74 |
+
}
|
| 75 |
+
bg_color = color_map.get(model_type, "#4F46E5")
|
| 76 |
+
display_label = label_map.get(model_type, model_type)
|
| 77 |
+
return f"""
|
| 78 |
+
<div style="
|
| 79 |
+
display: inline-flex;
|
| 80 |
+
align-items: center;
|
| 81 |
+
padding: 4px 8px;
|
| 82 |
+
background: {bg_color};
|
| 83 |
+
color: white;
|
| 84 |
+
border-radius: 4px;
|
| 85 |
+
font-size: 0.85em;
|
| 86 |
+
font-weight: 500;
|
| 87 |
+
">
|
| 88 |
+
{display_label}
|
| 89 |
+
</div>
|
| 90 |
+
"""
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def get_score_bar(score):
|
| 94 |
+
"""Generate HTML for score bar with gradient styling"""
|
| 95 |
+
width = score * 100
|
| 96 |
+
return f"""
|
| 97 |
+
<div style="display: flex; align-items: center; gap: 12px; width: 100%;">
|
| 98 |
+
<div style="
|
| 99 |
+
flex-grow: 1;
|
| 100 |
+
height: 8px;
|
| 101 |
+
background: var(--score-bg, rgba(255, 255, 255, 0.1));
|
| 102 |
+
border-radius: 4px;
|
| 103 |
+
overflow: hidden;
|
| 104 |
+
max-width: 200px;
|
| 105 |
+
">
|
| 106 |
+
<div style="
|
| 107 |
+
width: {width}%;
|
| 108 |
+
height: 100%;
|
| 109 |
+
background: linear-gradient(90deg, var(--accent-blue, #60A5FA), var(--accent-purple, #A78BFA));
|
| 110 |
+
border-radius: 4px;
|
| 111 |
+
transition: width 0.3s ease;
|
| 112 |
+
"></div>
|
| 113 |
+
</div>
|
| 114 |
+
<span style="
|
| 115 |
+
font-family: 'SF Mono', monospace;
|
| 116 |
+
font-weight: 600;
|
| 117 |
+
color: var(--text-primary, #ffffff);
|
| 118 |
+
min-width: 60px;
|
| 119 |
+
">{score:.3f}</span>
|
| 120 |
+
</div>
|
| 121 |
+
"""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def get_output_type_badge(output_type):
|
| 125 |
+
"""Generate HTML for output type badges with different colors, supporting both light and dark themes"""
|
| 126 |
+
type_styles = {
|
| 127 |
+
"Normal": {
|
| 128 |
+
"light": {"bg": "#F3F4F6", "color": "#374151"},
|
| 129 |
+
"dark": {"bg": "#374151", "color": "#F3F4F6"},
|
| 130 |
+
},
|
| 131 |
+
"Reasoning": {
|
| 132 |
+
"light": {"bg": "#DBEAFE", "color": "#1E40AF"},
|
| 133 |
+
"dark": {"bg": "#1E40AF", "color": "#DBEAFE"},
|
| 134 |
+
},
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
style = type_styles.get(output_type, type_styles["Normal"])
|
| 138 |
+
return f"""
|
| 139 |
+
<span style="
|
| 140 |
+
background: var(--bg-color, {style['light']['bg']});
|
| 141 |
+
color: var(--text-color, {style['light']['color']});
|
| 142 |
+
padding: 4px 8px;
|
| 143 |
+
border-radius: 4px;
|
| 144 |
+
font-size: 0.875rem;
|
| 145 |
+
font-weight: 500;
|
| 146 |
+
">
|
| 147 |
+
{output_type}
|
| 148 |
+
</span>
|
| 149 |
+
"""
|
visualization.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from utils import get_chart_colors
|
| 2 |
+
import matplotlib
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import numpy as np
|
| 5 |
+
import plotly.graph_objects as go
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def setup_matplotlib():
|
| 9 |
+
matplotlib.use("Agg")
|
| 10 |
+
plt.close("all")
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_performance_chart(df, category_name="Overall"):
|
| 14 |
+
plt.close("all")
|
| 15 |
+
colors = get_chart_colors()
|
| 16 |
+
score_column = "Category Score"
|
| 17 |
+
df_sorted = df.sort_values(score_column, ascending=True)
|
| 18 |
+
|
| 19 |
+
height = max(8, len(df_sorted) * 0.8)
|
| 20 |
+
fig, ax = plt.subplots(figsize=(16, height))
|
| 21 |
+
plt.rcParams.update({"font.size": 12})
|
| 22 |
+
|
| 23 |
+
fig.patch.set_facecolor(colors["background"])
|
| 24 |
+
ax.set_facecolor(colors["background"])
|
| 25 |
+
|
| 26 |
+
try:
|
| 27 |
+
bars = ax.barh(
|
| 28 |
+
np.arange(len(df_sorted)),
|
| 29 |
+
df_sorted[score_column],
|
| 30 |
+
height=0.4,
|
| 31 |
+
capstyle="round",
|
| 32 |
+
color=[colors[t] for t in df_sorted["Model Type"]],
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
ax.set_title(
|
| 36 |
+
f"Model Performance - {category_name}",
|
| 37 |
+
pad=20,
|
| 38 |
+
fontsize=20,
|
| 39 |
+
fontweight="bold",
|
| 40 |
+
color=colors["text"],
|
| 41 |
+
)
|
| 42 |
+
ax.set_xlabel(
|
| 43 |
+
"Average Score (Tool Selection Quality)",
|
| 44 |
+
fontsize=14,
|
| 45 |
+
fontweight="bold",
|
| 46 |
+
labelpad=10,
|
| 47 |
+
color=colors["text"],
|
| 48 |
+
)
|
| 49 |
+
ax.set_xlim(0.0, 1.0)
|
| 50 |
+
|
| 51 |
+
ax.set_yticks(np.arange(len(df_sorted)))
|
| 52 |
+
ax.set_yticklabels(
|
| 53 |
+
df_sorted["Model"], fontsize=12, fontweight="bold", color=colors["text"]
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
plt.subplots_adjust(left=0.35)
|
| 57 |
+
|
| 58 |
+
for i, v in enumerate(df_sorted[score_column]):
|
| 59 |
+
ax.text(
|
| 60 |
+
v + 0.01,
|
| 61 |
+
i,
|
| 62 |
+
f"{v:.3f}",
|
| 63 |
+
va="center",
|
| 64 |
+
fontsize=12,
|
| 65 |
+
fontweight="bold",
|
| 66 |
+
color=colors["text"],
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
ax.grid(True, axis="x", linestyle="--", alpha=0.2, color=colors["grid"])
|
| 70 |
+
ax.spines[["top", "right"]].set_visible(False)
|
| 71 |
+
ax.spines[["bottom", "left"]].set_color(colors["grid"])
|
| 72 |
+
ax.tick_params(colors=colors["text"])
|
| 73 |
+
|
| 74 |
+
legend_elements = [
|
| 75 |
+
plt.Rectangle((0, 0), 1, 1, facecolor=color, label=label)
|
| 76 |
+
for label, color in {
|
| 77 |
+
k: colors[k] for k in ["Private", "Open source"]
|
| 78 |
+
}.items()
|
| 79 |
+
]
|
| 80 |
+
ax.legend(
|
| 81 |
+
handles=legend_elements,
|
| 82 |
+
title="Model Type",
|
| 83 |
+
loc="lower right",
|
| 84 |
+
fontsize=12,
|
| 85 |
+
title_fontsize=14,
|
| 86 |
+
facecolor=colors["background"],
|
| 87 |
+
labelcolor=colors["text"],
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
plt.tight_layout()
|
| 91 |
+
return fig
|
| 92 |
+
finally:
|
| 93 |
+
plt.close(fig)
|
| 94 |
+
|
| 95 |
+
def create_radar_plot(df, model_names):
|
| 96 |
+
datasets = [col for col in df.columns[7:] if col != "IO Cost"]
|
| 97 |
+
fig = go.Figure()
|
| 98 |
+
|
| 99 |
+
colors = ["rgba(99, 102, 241, 0.3)", "rgba(34, 197, 94, 0.3)"]
|
| 100 |
+
line_colors = ["#4F46E5", "#16A34A"]
|
| 101 |
+
|
| 102 |
+
for idx, model_name in enumerate(model_names):
|
| 103 |
+
model_data = df[df["Model"] == model_name].iloc[0]
|
| 104 |
+
values = [model_data[m] for m in datasets]
|
| 105 |
+
values.append(values[0])
|
| 106 |
+
datasets_plot = datasets + [datasets[0]]
|
| 107 |
+
|
| 108 |
+
fig.add_trace(
|
| 109 |
+
go.Scatterpolar(
|
| 110 |
+
r=values,
|
| 111 |
+
theta=datasets_plot,
|
| 112 |
+
fill="toself",
|
| 113 |
+
fillcolor=colors[idx % len(colors)],
|
| 114 |
+
line=dict(color=line_colors[idx % len(line_colors)], width=2),
|
| 115 |
+
name=model_name,
|
| 116 |
+
text=[f"{val:.3f}" for val in values],
|
| 117 |
+
textposition="middle right",
|
| 118 |
+
mode="lines+markers+text",
|
| 119 |
+
)
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
fig.update_layout(
|
| 123 |
+
polar=dict(
|
| 124 |
+
radialaxis=dict(
|
| 125 |
+
visible=True, range=[0, 1], showline=False, tickfont=dict(size=12)
|
| 126 |
+
),
|
| 127 |
+
angularaxis=dict(
|
| 128 |
+
tickfont=dict(size=13, family="Arial"),
|
| 129 |
+
rotation=90,
|
| 130 |
+
direction="clockwise",
|
| 131 |
+
),
|
| 132 |
+
domain=dict(x=[0.1, 0.9], y=[0.1, 0.9])
|
| 133 |
+
),
|
| 134 |
+
showlegend=True,
|
| 135 |
+
legend=dict(
|
| 136 |
+
orientation="h",
|
| 137 |
+
yanchor="bottom",
|
| 138 |
+
y=-0.15,
|
| 139 |
+
xanchor="center",
|
| 140 |
+
x=0.5,
|
| 141 |
+
font=dict(size=14),
|
| 142 |
+
),
|
| 143 |
+
title=dict(
|
| 144 |
+
text="Model Comparison",
|
| 145 |
+
x=0.5,
|
| 146 |
+
y=0.95,
|
| 147 |
+
font=dict(size=24, family="Arial", color="#1F2937"),
|
| 148 |
+
),
|
| 149 |
+
paper_bgcolor="white",
|
| 150 |
+
plot_bgcolor="white",
|
| 151 |
+
height=800,
|
| 152 |
+
width=900,
|
| 153 |
+
margin=dict(t=30, b=50, l=10, r=10),
|
| 154 |
+
autosize=True,
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
return fig
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def get_performance_cost_chart(df, category_name="Overall"):
|
| 161 |
+
colors = get_chart_colors()
|
| 162 |
+
fig, ax = plt.subplots(figsize=(12, 8), dpi=300)
|
| 163 |
+
|
| 164 |
+
fig.patch.set_facecolor(colors["background"])
|
| 165 |
+
ax.set_facecolor(colors["background"])
|
| 166 |
+
ax.grid(True, linestyle="--", alpha=0.15, which="both", color=colors["grid"])
|
| 167 |
+
|
| 168 |
+
score_column = "Category Score"
|
| 169 |
+
|
| 170 |
+
for _, row in df.iterrows():
|
| 171 |
+
color = colors[row["Model Type"]]
|
| 172 |
+
size = 100 if row[score_column] > 0.85 else 80
|
| 173 |
+
edge_color = (
|
| 174 |
+
colors["Private"]
|
| 175 |
+
if row["Model Type"] == "Private"
|
| 176 |
+
else colors["Open source"]
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
ax.scatter(
|
| 180 |
+
row["IO Cost"],
|
| 181 |
+
row[score_column] * 100,
|
| 182 |
+
c=color,
|
| 183 |
+
s=size,
|
| 184 |
+
alpha=0.9,
|
| 185 |
+
edgecolor=edge_color,
|
| 186 |
+
linewidth=1,
|
| 187 |
+
zorder=5,
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
bbox_props = dict(
|
| 191 |
+
boxstyle="round,pad=0.3", fc=colors["background"], ec="none", alpha=0.8
|
| 192 |
+
)
|
| 193 |
+
|
| 194 |
+
ax.annotate(
|
| 195 |
+
f"{row['Model']}\n(${row['IO Cost']:.2f})",
|
| 196 |
+
(row["IO Cost"], row[score_column] * 100),
|
| 197 |
+
xytext=(5, 5),
|
| 198 |
+
textcoords="offset points",
|
| 199 |
+
fontsize=8,
|
| 200 |
+
fontweight="bold",
|
| 201 |
+
color=colors["text"],
|
| 202 |
+
bbox=bbox_props,
|
| 203 |
+
zorder=6,
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
ax.set_xscale("log")
|
| 207 |
+
ax.set_xlim(0.08, 1000)
|
| 208 |
+
ax.set_ylim(60, 100)
|
| 209 |
+
|
| 210 |
+
ax.set_xlabel(
|
| 211 |
+
"I/O Cost per Million Tokens ($)",
|
| 212 |
+
fontsize=10,
|
| 213 |
+
fontweight="bold",
|
| 214 |
+
labelpad=10,
|
| 215 |
+
color=colors["text"],
|
| 216 |
+
)
|
| 217 |
+
ax.set_ylabel(
|
| 218 |
+
"Model Performance Score",
|
| 219 |
+
fontsize=10,
|
| 220 |
+
fontweight="bold",
|
| 221 |
+
labelpad=10,
|
| 222 |
+
color=colors["text"],
|
| 223 |
+
)
|
| 224 |
+
|
| 225 |
+
legend_elements = [
|
| 226 |
+
plt.scatter([], [], c=colors[label], label=label, s=80)
|
| 227 |
+
for label in ["Private", "Open source"]
|
| 228 |
+
]
|
| 229 |
+
ax.legend(
|
| 230 |
+
handles=legend_elements,
|
| 231 |
+
loc="upper right",
|
| 232 |
+
frameon=True,
|
| 233 |
+
facecolor=colors["background"],
|
| 234 |
+
edgecolor="none",
|
| 235 |
+
fontsize=9,
|
| 236 |
+
labelcolor=colors["text"],
|
| 237 |
+
)
|
| 238 |
+
|
| 239 |
+
ax.set_title(
|
| 240 |
+
f"Performance vs. Cost - {category_name}",
|
| 241 |
+
fontsize=14,
|
| 242 |
+
pad=15,
|
| 243 |
+
fontweight="bold",
|
| 244 |
+
color=colors["text"],
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
for y1, y2, color in zip([85, 75, 60], [100, 85, 75], colors["performance_bands"]):
|
| 248 |
+
ax.axhspan(y1, y2, alpha=0.2, color=color, zorder=1)
|
| 249 |
+
|
| 250 |
+
ax.tick_params(axis="both", which="major", labelsize=9, colors=colors["text"])
|
| 251 |
+
ax.tick_params(axis="both", which="minor", labelsize=8, colors=colors["text"])
|
| 252 |
+
ax.xaxis.set_minor_locator(plt.LogLocator(base=10.0, subs=np.arange(2, 10) * 0.1))
|
| 253 |
+
|
| 254 |
+
for spine in ax.spines.values():
|
| 255 |
+
spine.set_color(colors["grid"])
|
| 256 |
+
|
| 257 |
+
plt.tight_layout()
|
| 258 |
+
return fig
|