Spaces:
Runtime error
Runtime error
Commit
Β·
4ae93a7
1
Parent(s):
2f78375
cleanup + refactor
Browse files
app.py
CHANGED
|
@@ -9,9 +9,9 @@ from utils import (
|
|
| 9 |
PROPRIETARY_LICENSES,
|
| 10 |
CAT_NAME_TO_EXPLANATION,
|
| 11 |
download_latest_data_from_space,
|
|
|
|
| 12 |
)
|
| 13 |
|
| 14 |
-
# with gr.NO_RELOAD:
|
| 15 |
###################
|
| 16 |
### Load Data
|
| 17 |
###################
|
|
@@ -72,43 +72,21 @@ merged_dfs = {k: format_data(v) for k, v in merged_dfs.items()}
|
|
| 72 |
|
| 73 |
|
| 74 |
# get constants
|
| 75 |
-
|
| 76 |
-
for k, df in merged_dfs.items():
|
| 77 |
-
filter_ranges[k] = {
|
| 78 |
-
"min_elo_score": df["rating"].min().round(),
|
| 79 |
-
"max_elo_score": df["rating"].max().round(),
|
| 80 |
-
"upper_models_per_month": int(
|
| 81 |
-
df.groupby(["Month-Year", "License"])["rating"]
|
| 82 |
-
.apply(lambda x: x.count())
|
| 83 |
-
.max()
|
| 84 |
-
),
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
min_elo_score = float("inf")
|
| 88 |
-
max_elo_score = float("-inf")
|
| 89 |
-
upper_models_per_month = 0
|
| 90 |
-
|
| 91 |
-
for key, value in filter_ranges.items():
|
| 92 |
-
min_elo_score = min(min_elo_score, value["min_elo_score"])
|
| 93 |
-
max_elo_score = max(max_elo_score, value["max_elo_score"])
|
| 94 |
-
upper_models_per_month = max(
|
| 95 |
-
upper_models_per_month, value["upper_models_per_month"]
|
| 96 |
-
)
|
| 97 |
-
|
| 98 |
|
| 99 |
date_updated = elo_results["full"]["last_updated_datetime"].split(" ")[0]
|
| 100 |
|
| 101 |
|
| 102 |
-
def get_data_split(dfs, set_name):
|
| 103 |
-
df = dfs[set_name].copy(deep=True)
|
| 104 |
-
return df.reset_index(drop=True)
|
| 105 |
-
|
| 106 |
-
|
| 107 |
###################
|
| 108 |
### Plot Data
|
| 109 |
###################
|
| 110 |
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
def build_plot(min_score, max_models_per_month, toggle_annotations, set_selector):
|
| 113 |
|
| 114 |
df = get_data_split(merged_dfs, set_name=set_selector)
|
|
@@ -172,7 +150,7 @@ with gr.Blocks(
|
|
| 172 |
gr.Markdown(
|
| 173 |
"""
|
| 174 |
<div style="text-align: center; max-width: 650px; margin: auto;">
|
| 175 |
-
<h1 style="font-weight: 900; margin-top: 5px;">π¬ Progress Tracker:
|
| 176 |
</h1>
|
| 177 |
<p style="text-align: left; margin-top: 10px; margin-bottom: 10px; line-height: 20px;">
|
| 178 |
This app visualizes the progress of proprietary and open-source LLMs in the LMSYS Arena ELO leaderboard. The idea is inspired by <a href="https://www.linkedin.com/posts/maxime-labonne_arena-elo-graph-updated-with-new-models-activity-7187062633735368705-u2jB?utm_source=share&utm_medium=member_desktop">this great work</a> from <a href="https://huggingface.co/mlabonne/">Maxime Labonne</a>.
|
|
|
|
| 9 |
PROPRIETARY_LICENSES,
|
| 10 |
CAT_NAME_TO_EXPLANATION,
|
| 11 |
download_latest_data_from_space,
|
| 12 |
+
get_constants,
|
| 13 |
)
|
| 14 |
|
|
|
|
| 15 |
###################
|
| 16 |
### Load Data
|
| 17 |
###################
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
# get constants
|
| 75 |
+
min_elo_score, max_elo_score, upper_models_per_month = get_constants(merged_dfs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
date_updated = elo_results["full"]["last_updated_datetime"].split(" ")[0]
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
###################
|
| 81 |
### Plot Data
|
| 82 |
###################
|
| 83 |
|
| 84 |
|
| 85 |
+
def get_data_split(dfs, set_name):
|
| 86 |
+
df = dfs[set_name].copy(deep=True)
|
| 87 |
+
return df.reset_index(drop=True)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
def build_plot(min_score, max_models_per_month, toggle_annotations, set_selector):
|
| 91 |
|
| 92 |
df = get_data_split(merged_dfs, set_name=set_selector)
|
|
|
|
| 150 |
gr.Markdown(
|
| 151 |
"""
|
| 152 |
<div style="text-align: center; max-width: 650px; margin: auto;">
|
| 153 |
+
<h1 style="font-weight: 900; margin-top: 5px;">π¬ Progress Tracker: Open vs. Proprietary LLMs
|
| 154 |
</h1>
|
| 155 |
<p style="text-align: left; margin-top: 10px; margin-bottom: 10px; line-height: 20px;">
|
| 156 |
This app visualizes the progress of proprietary and open-source LLMs in the LMSYS Arena ELO leaderboard. The idea is inspired by <a href="https://www.linkedin.com/posts/maxime-labonne_arena-elo-graph-updated-with-new-models-activity-7187062633735368705-u2jB?utm_source=share&utm_medium=member_desktop">this great work</a> from <a href="https://huggingface.co/mlabonne/">Maxime Labonne</a>.
|
utils.py
CHANGED
|
@@ -58,3 +58,40 @@ def download_latest_data_from_space(
|
|
| 58 |
repo_type="space",
|
| 59 |
)
|
| 60 |
return latest_filepath_local
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
repo_type="space",
|
| 59 |
)
|
| 60 |
return latest_filepath_local
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def get_constants(dfs):
|
| 64 |
+
"""
|
| 65 |
+
Calculate and return the minimum and maximum Elo scores, as well as the maximum number of models per month.
|
| 66 |
+
|
| 67 |
+
Parameters:
|
| 68 |
+
- dfs (dict): A dictionary containing DataFrames for different categories.
|
| 69 |
+
|
| 70 |
+
Returns:
|
| 71 |
+
- min_elo_score (float): The minimum Elo score across all DataFrames.
|
| 72 |
+
- max_elo_score (float): The maximum Elo score across all DataFrames.
|
| 73 |
+
- upper_models_per_month (int): The maximum number of models per month per license across all DataFrames.
|
| 74 |
+
"""
|
| 75 |
+
filter_ranges = {}
|
| 76 |
+
for k, df in dfs.items():
|
| 77 |
+
filter_ranges[k] = {
|
| 78 |
+
"min_elo_score": df["rating"].min().round(),
|
| 79 |
+
"max_elo_score": df["rating"].max().round(),
|
| 80 |
+
"upper_models_per_month": int(
|
| 81 |
+
df.groupby(["Month-Year", "License"])["rating"]
|
| 82 |
+
.apply(lambda x: x.count())
|
| 83 |
+
.max()
|
| 84 |
+
),
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
min_elo_score = float("inf")
|
| 88 |
+
max_elo_score = float("-inf")
|
| 89 |
+
upper_models_per_month = 0
|
| 90 |
+
|
| 91 |
+
for _, value in filter_ranges.items():
|
| 92 |
+
min_elo_score = min(min_elo_score, value["min_elo_score"])
|
| 93 |
+
max_elo_score = max(max_elo_score, value["max_elo_score"])
|
| 94 |
+
upper_models_per_month = max(
|
| 95 |
+
upper_models_per_month, value["upper_models_per_month"]
|
| 96 |
+
)
|
| 97 |
+
return min_elo_score, max_elo_score, upper_models_per_month
|