Spaces:
Sleeping
Sleeping
Commit
Β·
0321f62
1
Parent(s):
e471c70
test new benchmarks
Browse files- app.py +174 -220
- src/utils.py +5 -0
app.py
CHANGED
|
@@ -26,95 +26,77 @@ LLM_PERF_LEADERBOARD_REPO = "optimum/llm-perf-leaderboard"
|
|
| 26 |
LLM_PERF_DATASET_REPO = "optimum/llm-perf-dataset"
|
| 27 |
OPTIMUM_TOKEN = os.environ.get("OPTIMUM_TOKEN", None)
|
| 28 |
|
| 29 |
-
|
| 30 |
-
TRUE_WEIGHT_CLASSES = {
|
| 31 |
-
"6B": "7B",
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
ALL_COLUMNS_MAPPING = {
|
| 35 |
-
"
|
| 36 |
-
"
|
|
|
|
| 37 |
#
|
| 38 |
"backend.name": "Backend π",
|
| 39 |
"backend.torch_dtype": "Dtype π₯",
|
|
|
|
| 40 |
"optimizations": "Optimizations π οΈ",
|
| 41 |
#
|
|
|
|
|
|
|
| 42 |
"generate.throughput(tokens/s)": "Throughput (tokens/s) β¬οΈ",
|
| 43 |
-
|
| 44 |
#
|
| 45 |
-
"best_scored_model": "Best Scored Model π",
|
| 46 |
-
"best_score": "Best Score (%) β¬οΈ",
|
| 47 |
}
|
| 48 |
ALL_COLUMNS_DATATYPES = [
|
|
|
|
| 49 |
"str",
|
| 50 |
"str",
|
| 51 |
#
|
| 52 |
"str",
|
| 53 |
"str",
|
| 54 |
"str",
|
|
|
|
| 55 |
#
|
|
|
|
| 56 |
"number",
|
| 57 |
-
# "number",
|
| 58 |
-
#
|
| 59 |
-
"markdown",
|
| 60 |
"number",
|
|
|
|
|
|
|
| 61 |
]
|
| 62 |
-
SORTING_COLUMN = ["
|
| 63 |
|
| 64 |
llm_perf_dataset_repo = load_dataset_repo(LLM_PERF_DATASET_REPO, OPTIMUM_TOKEN)
|
| 65 |
|
| 66 |
|
| 67 |
-
def get_benchmark_df(benchmark="1xA100-80GB"):
|
| 68 |
if llm_perf_dataset_repo:
|
| 69 |
llm_perf_dataset_repo.git_pull()
|
| 70 |
|
| 71 |
-
# load
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
)
|
| 76 |
-
|
| 77 |
-
bench_df["merge_id"] = bench_df.experiment_name.str.split("_1_1000_").str[-1]
|
| 78 |
-
scores_df["merge_id"] = scores_df.weight_class + "_" + scores_df.model_type
|
| 79 |
-
merged_df = bench_df.merge(scores_df, on="merge_id")
|
| 80 |
-
|
| 81 |
-
# fix some weight classes
|
| 82 |
-
merged_df["weight_class"] = merged_df["weight_class"].apply(
|
| 83 |
-
lambda x: TRUE_WEIGHT_CLASSES[x] if x in TRUE_WEIGHT_CLASSES else x
|
| 84 |
-
)
|
| 85 |
-
|
| 86 |
-
# convert peak memory to int
|
| 87 |
-
# merged_df["forward.peak_memory(MB)"] = merged_df["forward.peak_memory(MB)"].apply(
|
| 88 |
-
# lambda x: int(x)
|
| 89 |
-
# )
|
| 90 |
-
|
| 91 |
# add optimizations
|
| 92 |
-
merged_df["optimizations"] = merged_df[
|
| 93 |
-
|
| 94 |
-
].apply(
|
| 95 |
-
lambda x: ", ".join(
|
| 96 |
-
filter(
|
| 97 |
-
lambda x: x != "",
|
| 98 |
-
[
|
| 99 |
-
"BetterTransformer" if x[0] == True else "",
|
| 100 |
-
"LLM.int8" if x[1] == True else "",
|
| 101 |
-
"LLM.fp4" if x[2] == True else "",
|
| 102 |
-
],
|
| 103 |
-
),
|
| 104 |
-
)
|
| 105 |
-
if any([x[0] == True, x[1] == True, x[2] == True])
|
| 106 |
-
else "None",
|
| 107 |
-
axis=1,
|
| 108 |
)
|
| 109 |
-
|
| 110 |
-
merged_df["
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
merged_df["
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
return merged_df
|
| 120 |
|
|
@@ -122,12 +104,11 @@ def get_benchmark_df(benchmark="1xA100-80GB"):
|
|
| 122 |
def get_benchmark_table(bench_df):
|
| 123 |
# add * to quantized models score
|
| 124 |
copy_df = bench_df.copy()
|
| 125 |
-
|
| 126 |
copy_df["best_score"] = copy_df.apply(
|
| 127 |
lambda x: f"{x['best_score']}**" if x["quantized"] else x["best_score"],
|
| 128 |
axis=1,
|
| 129 |
)
|
| 130 |
-
|
| 131 |
# sort
|
| 132 |
copy_df.sort_values(by=SORTING_COLUMN, ascending=True, inplace=True)
|
| 133 |
# filter
|
|
@@ -135,62 +116,45 @@ def get_benchmark_table(bench_df):
|
|
| 135 |
# rename
|
| 136 |
copy_df.rename(columns=ALL_COLUMNS_MAPPING, inplace=True)
|
| 137 |
# transform
|
| 138 |
-
copy_df["Type π€"] = copy_df["Type π€"].apply(process_model_type)
|
| 139 |
copy_df["Best Scored Model π"] = copy_df["Best Scored Model π"].apply(
|
| 140 |
process_model_name
|
| 141 |
)
|
| 142 |
-
|
| 143 |
return copy_df
|
| 144 |
|
| 145 |
|
| 146 |
def get_benchmark_plot(bench_df):
|
| 147 |
fig = px.scatter(
|
| 148 |
bench_df,
|
| 149 |
-
x="generate.latency(s)",
|
| 150 |
y="best_score",
|
|
|
|
|
|
|
| 151 |
color="model_type",
|
| 152 |
-
|
| 153 |
-
custom_data=[
|
| 154 |
-
"best_scored_model",
|
| 155 |
-
"backend.name",
|
| 156 |
-
"backend.torch_dtype",
|
| 157 |
-
"optimizations",
|
| 158 |
-
# "forward.peak_memory(MB)",
|
| 159 |
-
"generate.throughput(tokens/s)",
|
| 160 |
-
],
|
| 161 |
color_discrete_sequence=px.colors.qualitative.Light24,
|
| 162 |
)
|
| 163 |
-
|
| 164 |
fig.update_layout(
|
| 165 |
title={
|
| 166 |
-
"text": "Model Score vs. Latency",
|
| 167 |
"y": 0.95,
|
| 168 |
"x": 0.5,
|
| 169 |
"xanchor": "center",
|
| 170 |
"yanchor": "top",
|
| 171 |
},
|
| 172 |
-
xaxis_title="
|
| 173 |
yaxis_title="Open LLM Score (%)",
|
| 174 |
legend_title="Model Type",
|
| 175 |
width=1200,
|
| 176 |
height=600,
|
| 177 |
)
|
| 178 |
-
|
| 179 |
fig.update_traces(
|
| 180 |
hovertemplate="<br>".join(
|
| 181 |
[
|
| 182 |
-
"
|
| 183 |
-
|
| 184 |
-
"Load Datatype: %{customdata[2]}",
|
| 185 |
-
"Optimizations: %{customdata[3]}",
|
| 186 |
-
# "Peak Memory (MB): %{customdata[4]}",
|
| 187 |
-
"Throughput (tokens/s): %{customdata[4]}",
|
| 188 |
-
"Per 1000 Tokens Latency (s): %{x}",
|
| 189 |
-
"Open LLM Score (%): %{y}",
|
| 190 |
]
|
| 191 |
)
|
| 192 |
)
|
| 193 |
-
|
| 194 |
return fig
|
| 195 |
|
| 196 |
|
|
@@ -200,11 +164,10 @@ def filter_query(
|
|
| 200 |
datatypes,
|
| 201 |
optimizations,
|
| 202 |
score,
|
| 203 |
-
|
| 204 |
-
benchmark="1xA100-80GB",
|
| 205 |
):
|
| 206 |
raw_df = get_benchmark_df(benchmark=benchmark)
|
| 207 |
-
|
| 208 |
filtered_df = raw_df[
|
| 209 |
raw_df["best_scored_model"].str.lower().str.contains(text.lower())
|
| 210 |
& raw_df["backend.name"].isin(backends)
|
|
@@ -221,155 +184,146 @@ def filter_query(
|
|
| 221 |
else True
|
| 222 |
)
|
| 223 |
& (raw_df["best_score"] >= score)
|
| 224 |
-
|
| 225 |
]
|
| 226 |
-
|
| 227 |
filtered_table = get_benchmark_table(filtered_df)
|
| 228 |
filtered_plot = get_benchmark_plot(filtered_df)
|
| 229 |
-
|
| 230 |
return filtered_table, filtered_plot
|
| 231 |
|
| 232 |
|
| 233 |
-
#
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
|
| 238 |
# Demo interface
|
| 239 |
demo = gr.Blocks(css=custom_css)
|
| 240 |
with demo:
|
| 241 |
# leaderboard title
|
| 242 |
gr.HTML(TITLE)
|
| 243 |
-
|
| 244 |
# introduction text
|
| 245 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="descriptive-text")
|
| 246 |
|
| 247 |
-
#
|
| 248 |
-
gr.
|
| 249 |
-
"
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
)
|
| 252 |
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
# )
|
| 266 |
-
|
| 267 |
-
# with gr.TabItem("π₯οΈ A100-80GB Plot π", id=1):
|
| 268 |
-
# gr.HTML(
|
| 269 |
-
# "π Hover over the points π for additional information.",
|
| 270 |
-
# elem_id="descriptive-text",
|
| 271 |
-
# )
|
| 272 |
-
# # Original leaderboard plot
|
| 273 |
-
# A100_plotly = gr.components.Plot(
|
| 274 |
-
# value=A100_plot,
|
| 275 |
-
# elem_id="1xA100-plot",
|
| 276 |
-
# show_label=False,
|
| 277 |
-
# )
|
| 278 |
-
|
| 279 |
-
# with gr.TabItem("Control Panel ποΈ", id=2):
|
| 280 |
-
# gr.HTML(
|
| 281 |
-
# "Use this control panel to filter the leaderboard's table and plot.",
|
| 282 |
-
# elem_id="descriptive-text",
|
| 283 |
-
# )
|
| 284 |
-
# # control panel interface
|
| 285 |
-
# with gr.Row():
|
| 286 |
-
# with gr.Column(scale=1):
|
| 287 |
-
# search_bar = gr.Textbox(
|
| 288 |
-
# label="Model π€",
|
| 289 |
-
# info="π Search for a model name",
|
| 290 |
-
# elem_id="search-bar",
|
| 291 |
-
# )
|
| 292 |
-
# with gr.Column(scale=1):
|
| 293 |
-
# with gr.Box():
|
| 294 |
-
# score_slider = gr.Slider(
|
| 295 |
-
# label="Open LLM Score π",
|
| 296 |
-
# info="ποΈ Slide to minimum Open LLM score",
|
| 297 |
-
# value=0,
|
| 298 |
-
# elem_id="threshold-slider",
|
| 299 |
-
# )
|
| 300 |
-
# # with gr.Column(scale=1):
|
| 301 |
-
# # with gr.Box():
|
| 302 |
-
# # memory_slider = gr.Slider(
|
| 303 |
-
# # label="Peak Memory (MB) π",
|
| 304 |
-
# # info="ποΈ Slide to maximum Peak Memory",
|
| 305 |
-
# # minimum=0,
|
| 306 |
-
# # maximum=80 * 1024,
|
| 307 |
-
# # value=80 * 1024,
|
| 308 |
-
# # elem_id="memory-slider",
|
| 309 |
-
# # )
|
| 310 |
-
|
| 311 |
-
# with gr.Row():
|
| 312 |
-
# with gr.Column(scale=1):
|
| 313 |
-
# backend_checkboxes = gr.CheckboxGroup(
|
| 314 |
-
# label="Backends π",
|
| 315 |
-
# choices=["pytorch", "onnxruntime"],
|
| 316 |
-
# value=["pytorch", "onnxruntime"],
|
| 317 |
-
# info="βοΈ Select the backends",
|
| 318 |
-
# elem_id="backend-checkboxes",
|
| 319 |
-
# )
|
| 320 |
-
# with gr.Column(scale=1):
|
| 321 |
-
# datatype_checkboxes = gr.CheckboxGroup(
|
| 322 |
-
# label="Dtypes π₯",
|
| 323 |
-
# choices=["float32", "float16"],
|
| 324 |
-
# value=["float32", "float16"],
|
| 325 |
-
# info="βοΈ Select the load dtypes",
|
| 326 |
-
# elem_id="dtype-checkboxes",
|
| 327 |
-
# )
|
| 328 |
-
# with gr.Column(scale=2):
|
| 329 |
-
# optimizations_checkboxes = gr.CheckboxGroup(
|
| 330 |
-
# label="Optimizations π οΈ",
|
| 331 |
-
# choices=["None", "BetterTransformer", "LLM.int8", "LLM.fp4"],
|
| 332 |
-
# value=["None", "BetterTransformer", "LLM.int8", "LLM.fp4"],
|
| 333 |
-
# info="βοΈ Select the optimizations",
|
| 334 |
-
# elem_id="optimizations-checkboxes",
|
| 335 |
-
# )
|
| 336 |
-
|
| 337 |
-
# with gr.Row():
|
| 338 |
-
# filter_button = gr.Button(
|
| 339 |
-
# value="Filter π",
|
| 340 |
-
# elem_id="filter-button",
|
| 341 |
-
# )
|
| 342 |
-
|
| 343 |
-
# with gr.TabItem("About π", id=3):
|
| 344 |
-
# gr.HTML(ABOUT_TEXT, elem_classes="descriptive-text")
|
| 345 |
-
# gr.Markdown(EXAMPLE_CONFIG_TEXT, elem_classes="descriptive-text")
|
| 346 |
-
|
| 347 |
-
# demo.load(
|
| 348 |
-
# change_tab,
|
| 349 |
-
# A100_tabs,
|
| 350 |
-
# _js=custom_js,
|
| 351 |
-
# )
|
| 352 |
-
|
| 353 |
-
# filter_button.click(
|
| 354 |
-
# filter_query,
|
| 355 |
-
# [
|
| 356 |
-
# search_bar,
|
| 357 |
-
# backend_checkboxes,
|
| 358 |
-
# datatype_checkboxes,
|
| 359 |
-
# optimizations_checkboxes,
|
| 360 |
-
# score_slider,
|
| 361 |
-
# # memory_slider,
|
| 362 |
-
# ],
|
| 363 |
-
# [A100_leaderboard, A100_plotly],
|
| 364 |
-
# )
|
| 365 |
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
|
| 374 |
|
| 375 |
# Restart space every hour
|
|
|
|
| 26 |
LLM_PERF_DATASET_REPO = "optimum/llm-perf-dataset"
|
| 27 |
OPTIMUM_TOKEN = os.environ.get("OPTIMUM_TOKEN", None)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
ALL_COLUMNS_MAPPING = {
|
| 30 |
+
"weight_class": "Weight Class ποΈ",
|
| 31 |
+
"model_type": "LLM Type π€",
|
| 32 |
+
"best_scored_model": "Best Scored LLM π",
|
| 33 |
#
|
| 34 |
"backend.name": "Backend π",
|
| 35 |
"backend.torch_dtype": "Dtype π₯",
|
| 36 |
+
"quantization": "Quantization ποΈ",
|
| 37 |
"optimizations": "Optimizations π οΈ",
|
| 38 |
#
|
| 39 |
+
"best_score": "Best Score (%) β¬οΈ",
|
| 40 |
+
"generate.peak_memory(MB)": "Memory (MB) β¬οΈ",
|
| 41 |
"generate.throughput(tokens/s)": "Throughput (tokens/s) β¬οΈ",
|
| 42 |
+
"generate.energy_consumption(kWh/token)": "Energy (kWh/token) β¬οΈ",
|
| 43 |
#
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
ALL_COLUMNS_DATATYPES = [
|
| 46 |
+
"str",
|
| 47 |
"str",
|
| 48 |
"str",
|
| 49 |
#
|
| 50 |
"str",
|
| 51 |
"str",
|
| 52 |
"str",
|
| 53 |
+
"str",
|
| 54 |
#
|
| 55 |
+
"str",
|
| 56 |
"number",
|
|
|
|
|
|
|
|
|
|
| 57 |
"number",
|
| 58 |
+
"number",
|
| 59 |
+
#
|
| 60 |
]
|
| 61 |
+
SORTING_COLUMN = ["perf_distance"]
|
| 62 |
|
| 63 |
llm_perf_dataset_repo = load_dataset_repo(LLM_PERF_DATASET_REPO, OPTIMUM_TOKEN)
|
| 64 |
|
| 65 |
|
| 66 |
+
def get_benchmark_df(benchmark="Succeeded-1xA100-80GB"):
|
| 67 |
if llm_perf_dataset_repo:
|
| 68 |
llm_perf_dataset_repo.git_pull()
|
| 69 |
|
| 70 |
+
# load data
|
| 71 |
+
benchmark_df = pd.read_csv(f"./llm-perf-dataset/reports/{benchmark}.csv")
|
| 72 |
+
clusters_df = pd.read_csv("./llm-perf-dataset/Clustered-Open-LLM-Leaderboard.csv")
|
| 73 |
+
# merge on model
|
| 74 |
+
merged_df = benchmark_df.merge(
|
| 75 |
+
clusters_df, left_on="model", right_on="best_scored_model"
|
| 76 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
# add optimizations
|
| 78 |
+
merged_df["optimizations"] = merged_df["backend.bettertransformer"].apply(
|
| 79 |
+
lambda x: "BetterTransformer" if x else "None"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
)
|
| 81 |
+
# add quantization scheme
|
| 82 |
+
merged_df["quantization"] = merged_df["backend.quantization_strategy"].apply(
|
| 83 |
+
lambda x: "BnB.4bit" if x == "bnb" else ("GPTQ.4bit" if x == "gptq" else "None")
|
| 84 |
+
)
|
| 85 |
+
# distance to 100% score, normalized to 0, 1
|
| 86 |
+
score_distance = (100 - merged_df["best_score"]) / 100
|
| 87 |
+
# distance to 0s latency, normalized to 0, 1
|
| 88 |
+
latency_distance = merged_df["generate.latency(s)"] / (
|
| 89 |
+
merged_df["generate.latency(s)"].max() - merged_df["generate.latency(s)"].min()
|
| 90 |
+
)
|
| 91 |
+
# distance to 0MB memory
|
| 92 |
+
memory_distance = merged_df["forward.peak_memory(MB)"] / (
|
| 93 |
+
merged_df["forward.peak_memory(MB)"].max()
|
| 94 |
+
- merged_df["forward.peak_memory(MB)"].min()
|
| 95 |
+
)
|
| 96 |
+
# add perf distance
|
| 97 |
+
merged_df["perf_distance"] = (
|
| 98 |
+
score_distance**2 + latency_distance**2 + memory_distance**2
|
| 99 |
+
) ** 0.5
|
| 100 |
|
| 101 |
return merged_df
|
| 102 |
|
|
|
|
| 104 |
def get_benchmark_table(bench_df):
|
| 105 |
# add * to quantized models score
|
| 106 |
copy_df = bench_df.copy()
|
| 107 |
+
# add * to quantized models score since we can't garantee the score is the same
|
| 108 |
copy_df["best_score"] = copy_df.apply(
|
| 109 |
lambda x: f"{x['best_score']}**" if x["quantized"] else x["best_score"],
|
| 110 |
axis=1,
|
| 111 |
)
|
|
|
|
| 112 |
# sort
|
| 113 |
copy_df.sort_values(by=SORTING_COLUMN, ascending=True, inplace=True)
|
| 114 |
# filter
|
|
|
|
| 116 |
# rename
|
| 117 |
copy_df.rename(columns=ALL_COLUMNS_MAPPING, inplace=True)
|
| 118 |
# transform
|
| 119 |
+
copy_df["LLM Type π€"] = copy_df["LLM Type π€"].apply(process_model_type)
|
| 120 |
copy_df["Best Scored Model π"] = copy_df["Best Scored Model π"].apply(
|
| 121 |
process_model_name
|
| 122 |
)
|
|
|
|
| 123 |
return copy_df
|
| 124 |
|
| 125 |
|
| 126 |
def get_benchmark_plot(bench_df):
|
| 127 |
fig = px.scatter(
|
| 128 |
bench_df,
|
|
|
|
| 129 |
y="best_score",
|
| 130 |
+
x="generate.throughput(tokens/s)",
|
| 131 |
+
size="generate.peak_memory(MB)",
|
| 132 |
color="model_type",
|
| 133 |
+
custom_data=list(ALL_COLUMNS_MAPPING.keys()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
color_discrete_sequence=px.colors.qualitative.Light24,
|
| 135 |
)
|
|
|
|
| 136 |
fig.update_layout(
|
| 137 |
title={
|
| 138 |
+
"text": "Model Score vs. Latency vs. Memory",
|
| 139 |
"y": 0.95,
|
| 140 |
"x": 0.5,
|
| 141 |
"xanchor": "center",
|
| 142 |
"yanchor": "top",
|
| 143 |
},
|
| 144 |
+
xaxis_title="Generation Throughput (tokens/s)",
|
| 145 |
yaxis_title="Open LLM Score (%)",
|
| 146 |
legend_title="Model Type",
|
| 147 |
width=1200,
|
| 148 |
height=600,
|
| 149 |
)
|
|
|
|
| 150 |
fig.update_traces(
|
| 151 |
hovertemplate="<br>".join(
|
| 152 |
[
|
| 153 |
+
f"<b>{ALL_COLUMNS_MAPPING[key]}:</b> %{{customdata[{i}]}}"
|
| 154 |
+
for i, key in enumerate(ALL_COLUMNS_MAPPING.keys())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
]
|
| 156 |
)
|
| 157 |
)
|
|
|
|
| 158 |
return fig
|
| 159 |
|
| 160 |
|
|
|
|
| 164 |
datatypes,
|
| 165 |
optimizations,
|
| 166 |
score,
|
| 167 |
+
memory,
|
| 168 |
+
benchmark="Succeeded-1xA100-80GB",
|
| 169 |
):
|
| 170 |
raw_df = get_benchmark_df(benchmark=benchmark)
|
|
|
|
| 171 |
filtered_df = raw_df[
|
| 172 |
raw_df["best_scored_model"].str.lower().str.contains(text.lower())
|
| 173 |
& raw_df["backend.name"].isin(backends)
|
|
|
|
| 184 |
else True
|
| 185 |
)
|
| 186 |
& (raw_df["best_score"] >= score)
|
| 187 |
+
& (raw_df["forward.peak_memory(MB)"] <= memory)
|
| 188 |
]
|
|
|
|
| 189 |
filtered_table = get_benchmark_table(filtered_df)
|
| 190 |
filtered_plot = get_benchmark_plot(filtered_df)
|
|
|
|
| 191 |
return filtered_table, filtered_plot
|
| 192 |
|
| 193 |
|
| 194 |
+
# Dataframes
|
| 195 |
+
A100_df = get_benchmark_df(benchmark="Succeeded-1xA100-80GB")
|
| 196 |
+
A100_table = get_benchmark_table(A100_df)
|
| 197 |
+
A100_plot = get_benchmark_plot(A100_df)
|
| 198 |
|
| 199 |
# Demo interface
|
| 200 |
demo = gr.Blocks(css=custom_css)
|
| 201 |
with demo:
|
| 202 |
# leaderboard title
|
| 203 |
gr.HTML(TITLE)
|
|
|
|
| 204 |
# introduction text
|
| 205 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="descriptive-text")
|
| 206 |
|
| 207 |
+
# leaderboard tabs
|
| 208 |
+
with gr.Tabs(elem_classes="A100-tabs") as A100_tabs:
|
| 209 |
+
with gr.TabItem("π₯οΈ A100-80GB Benchmark π", id=0):
|
| 210 |
+
gr.HTML(
|
| 211 |
+
"π Scroll to the right π for more columns.", elem_id="descriptive-text"
|
| 212 |
+
)
|
| 213 |
+
# Original leaderboard table
|
| 214 |
+
A100_leaderboard = gr.components.Dataframe(
|
| 215 |
+
value=A100_table,
|
| 216 |
+
datatype=ALL_COLUMNS_DATATYPES,
|
| 217 |
+
headers=list(ALL_COLUMNS_MAPPING.values()),
|
| 218 |
+
elem_id="1xA100-table",
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
with gr.TabItem("π₯οΈ A100-80GB Plot π", id=1):
|
| 222 |
+
gr.HTML(
|
| 223 |
+
"π Hover over the points π for additional information.",
|
| 224 |
+
elem_id="descriptive-text",
|
| 225 |
+
)
|
| 226 |
+
# Original leaderboard plot
|
| 227 |
+
A100_plotly = gr.components.Plot(
|
| 228 |
+
value=A100_plot,
|
| 229 |
+
elem_id="1xA100-plot",
|
| 230 |
+
show_label=False,
|
| 231 |
+
)
|
| 232 |
+
|
| 233 |
+
with gr.TabItem("Control Panel ποΈ", id=2):
|
| 234 |
+
gr.HTML(
|
| 235 |
+
"Use this control panel to filter the leaderboard's table and plot.",
|
| 236 |
+
elem_id="descriptive-text",
|
| 237 |
+
)
|
| 238 |
+
# control panel interface
|
| 239 |
+
with gr.Row():
|
| 240 |
+
with gr.Column(scale=1):
|
| 241 |
+
search_bar = gr.Textbox(
|
| 242 |
+
label="Model π€",
|
| 243 |
+
info="π Search for a model name",
|
| 244 |
+
elem_id="search-bar",
|
| 245 |
+
)
|
| 246 |
+
with gr.Column(scale=1):
|
| 247 |
+
with gr.Box():
|
| 248 |
+
score_slider = gr.Slider(
|
| 249 |
+
label="Open LLM Score π",
|
| 250 |
+
info="ποΈ Slide to minimum Open LLM score",
|
| 251 |
+
value=0,
|
| 252 |
+
elem_id="threshold-slider",
|
| 253 |
+
)
|
| 254 |
+
with gr.Column(scale=1):
|
| 255 |
+
with gr.Box():
|
| 256 |
+
memory_slider = gr.Slider(
|
| 257 |
+
label="Peak Memory (MB) π",
|
| 258 |
+
info="ποΈ Slide to maximum Peak Memory",
|
| 259 |
+
minimum=0,
|
| 260 |
+
maximum=80 * 1024,
|
| 261 |
+
value=80 * 1024,
|
| 262 |
+
elem_id="memory-slider",
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
with gr.Row():
|
| 266 |
+
with gr.Column(scale=1):
|
| 267 |
+
backend_checkboxes = gr.CheckboxGroup(
|
| 268 |
+
label="Backends π",
|
| 269 |
+
choices=["pytorch", "onnxruntime"],
|
| 270 |
+
value=["pytorch", "onnxruntime"],
|
| 271 |
+
info="βοΈ Select the backends",
|
| 272 |
+
elem_id="backend-checkboxes",
|
| 273 |
+
)
|
| 274 |
+
with gr.Column(scale=1):
|
| 275 |
+
datatype_checkboxes = gr.CheckboxGroup(
|
| 276 |
+
label="Dtypes π₯",
|
| 277 |
+
choices=["float32", "float16"],
|
| 278 |
+
value=["float32", "float16"],
|
| 279 |
+
info="βοΈ Select the load dtypes",
|
| 280 |
+
elem_id="dtype-checkboxes",
|
| 281 |
+
)
|
| 282 |
+
with gr.Column(scale=2):
|
| 283 |
+
optimizations_checkboxes = gr.CheckboxGroup(
|
| 284 |
+
label="Optimizations π οΈ",
|
| 285 |
+
choices=["None", "BetterTransformer"],
|
| 286 |
+
value=["None", "BetterTransformer"],
|
| 287 |
+
info="βοΈ Select the optimizations",
|
| 288 |
+
elem_id="optimizations-checkboxes",
|
| 289 |
+
)
|
| 290 |
+
|
| 291 |
+
with gr.Row():
|
| 292 |
+
filter_button = gr.Button(
|
| 293 |
+
value="Filter π",
|
| 294 |
+
elem_id="filter-button",
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
with gr.TabItem("About π", id=3):
|
| 298 |
+
gr.HTML(ABOUT_TEXT, elem_classes="descriptive-text")
|
| 299 |
+
gr.Markdown(EXAMPLE_CONFIG_TEXT, elem_classes="descriptive-text")
|
| 300 |
+
|
| 301 |
+
demo.load(
|
| 302 |
+
change_tab,
|
| 303 |
+
A100_tabs,
|
| 304 |
+
_js=custom_js,
|
| 305 |
)
|
| 306 |
|
| 307 |
+
filter_button.click(
|
| 308 |
+
filter_query,
|
| 309 |
+
[
|
| 310 |
+
search_bar,
|
| 311 |
+
backend_checkboxes,
|
| 312 |
+
datatype_checkboxes,
|
| 313 |
+
optimizations_checkboxes,
|
| 314 |
+
score_slider,
|
| 315 |
+
memory_slider,
|
| 316 |
+
],
|
| 317 |
+
[A100_leaderboard, A100_plotly],
|
| 318 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
|
| 320 |
+
with gr.Row():
|
| 321 |
+
with gr.Accordion("π Citation", open=False):
|
| 322 |
+
citation_button = gr.Textbox(
|
| 323 |
+
value=CITATION_BUTTON_TEXT,
|
| 324 |
+
label=CITATION_BUTTON_LABEL,
|
| 325 |
+
elem_id="citation-button",
|
| 326 |
+
).style(show_copy_button=True)
|
| 327 |
|
| 328 |
|
| 329 |
# Restart space every hour
|
src/utils.py
CHANGED
|
@@ -37,12 +37,15 @@ def load_dataset_repo(LLM_PERF_DATASET_REPO, OPTIMUM_TOKEN):
|
|
| 37 |
|
| 38 |
|
| 39 |
LLM_MODEL_TYPES = {
|
|
|
|
| 40 |
"gpt_bigcode": "GPT-BigCode πΈ",
|
| 41 |
"RefinedWebModel": "Falcon π¦
",
|
| 42 |
"RefinedWeb": "Falcon π¦
",
|
| 43 |
"baichuan": "Baichuan π",
|
| 44 |
"bloom": "Bloom πΈ",
|
| 45 |
"llama": "LLaMA π¦",
|
|
|
|
|
|
|
| 46 |
"gpt_neox": "GPT-NeoX",
|
| 47 |
"gpt_neo": "GPT-Neo",
|
| 48 |
"codegen": "CodeGen",
|
|
@@ -50,6 +53,8 @@ LLM_MODEL_TYPES = {
|
|
| 50 |
"gpt2": "GPT-2",
|
| 51 |
"gptj": "GPT-J",
|
| 52 |
"xglm": "XGLM",
|
|
|
|
|
|
|
| 53 |
"opt": "OPT",
|
| 54 |
"mpt": "MPT",
|
| 55 |
}
|
|
|
|
| 37 |
|
| 38 |
|
| 39 |
LLM_MODEL_TYPES = {
|
| 40 |
+
# branded ?
|
| 41 |
"gpt_bigcode": "GPT-BigCode πΈ",
|
| 42 |
"RefinedWebModel": "Falcon π¦
",
|
| 43 |
"RefinedWeb": "Falcon π¦
",
|
| 44 |
"baichuan": "Baichuan π",
|
| 45 |
"bloom": "Bloom πΈ",
|
| 46 |
"llama": "LLaMA π¦",
|
| 47 |
+
# unbranded ? suggest something
|
| 48 |
+
"stablelm_alpha": "StableLM-Alpha",
|
| 49 |
"gpt_neox": "GPT-NeoX",
|
| 50 |
"gpt_neo": "GPT-Neo",
|
| 51 |
"codegen": "CodeGen",
|
|
|
|
| 53 |
"gpt2": "GPT-2",
|
| 54 |
"gptj": "GPT-J",
|
| 55 |
"xglm": "XGLM",
|
| 56 |
+
"rwkv": "RWKV",
|
| 57 |
+
"bart": "BART",
|
| 58 |
"opt": "OPT",
|
| 59 |
"mpt": "MPT",
|
| 60 |
}
|