Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
whisper-leaderboard
#31
by
Steveeeeeeen
HF Staff
- opened
app.py
CHANGED
|
@@ -22,14 +22,32 @@ column_names = {
|
|
| 22 |
"Voxpopuli WER": "Voxpopuli",
|
| 23 |
}
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
if not csv_results.exists():
|
| 28 |
raise Exception(f"CSV file {csv_results} does not exist locally")
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
# Get csv with data and parse columns
|
| 31 |
original_df = pd.read_csv(csv_results)
|
| 32 |
-
|
| 33 |
# Formats the columns
|
| 34 |
def formatter(x):
|
| 35 |
if type(x) is str:
|
|
@@ -43,9 +61,31 @@ for col in original_df.columns:
|
|
| 43 |
original_df[col] = original_df[col].apply(lambda x: x.replace(x, make_clickable_model(x)))
|
| 44 |
else:
|
| 45 |
original_df[col] = original_df[col].apply(formatter) # For numerical values
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
original_df.rename(columns=column_names, inplace=True)
|
| 48 |
original_df.sort_values(by='Average WER ⬇️', inplace=True)
|
|
|
|
|
|
|
| 49 |
|
| 50 |
COLS = [c.name for c in fields(AutoEvalColumn)]
|
| 51 |
TYPES = [c.type for c in fields(AutoEvalColumn)]
|
|
@@ -115,11 +155,58 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
| 115 |
interactive=False,
|
| 116 |
visible=True,
|
| 117 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
| 121 |
|
| 122 |
-
with gr.TabItem("✉️✨ Request a model here!", elem_id="od-benchmark-tab-table", id=
|
| 123 |
with gr.Column():
|
| 124 |
gr.Markdown("# ✉️✨ Request results for a new model here!", elem_classes="markdown-text")
|
| 125 |
with gr.Column():
|
|
@@ -133,6 +220,9 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
| 133 |
btn_submitt.click(request_model,
|
| 134 |
[model_name_textbox, chb_coco2017],
|
| 135 |
mdw_submission_result)
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
| 138 |
|
|
|
|
| 22 |
"Voxpopuli WER": "Voxpopuli",
|
| 23 |
}
|
| 24 |
|
| 25 |
+
whisper_column_names = {
|
| 26 |
+
"MODEL": "Model",
|
| 27 |
+
"Avg. WER": "Average WER ⬇️",
|
| 28 |
+
"RTFx": "RTFx ⬆️️",
|
| 29 |
+
"Backend": "Backend",
|
| 30 |
+
"Hardware": "Device",
|
| 31 |
+
"AMI WER": "AMI",
|
| 32 |
+
"Earnings22 WER": "Earnings22",
|
| 33 |
+
"Gigaspeech WER": "Gigaspeech",
|
| 34 |
+
"LS Clean WER": "LS Clean",
|
| 35 |
+
"LS Other WER": "LS Other",
|
| 36 |
+
"SPGISpeech WER": "SPGISpeech",
|
| 37 |
+
"Tedlium WER": "Tedlium",
|
| 38 |
+
"Voxpopuli WER": "Voxpopuli",
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
eval_queue_repo, requested_models, csv_results, whisper_eval_queue_repo, whisper_csv_results = load_all_info_from_dataset_hub()
|
| 42 |
|
| 43 |
if not csv_results.exists():
|
| 44 |
raise Exception(f"CSV file {csv_results} does not exist locally")
|
| 45 |
+
if not whisper_csv_results.exists():
|
| 46 |
+
raise Exception(f"CSV file {whisper_csv_results} does not exist locally")
|
| 47 |
+
|
| 48 |
# Get csv with data and parse columns
|
| 49 |
original_df = pd.read_csv(csv_results)
|
| 50 |
+
whisper_df = pd.read_csv(whisper_csv_results)
|
| 51 |
# Formats the columns
|
| 52 |
def formatter(x):
|
| 53 |
if type(x) is str:
|
|
|
|
| 61 |
original_df[col] = original_df[col].apply(lambda x: x.replace(x, make_clickable_model(x)))
|
| 62 |
else:
|
| 63 |
original_df[col] = original_df[col].apply(formatter) # For numerical values
|
| 64 |
+
|
| 65 |
+
def filter_whisper_table(backends, device):
|
| 66 |
+
filtered_df = whisper_df.copy()
|
| 67 |
+
|
| 68 |
+
# Handle backend filtering
|
| 69 |
+
if backends and "All" not in backends:
|
| 70 |
+
filtered_df = filtered_df[filtered_df["Backend"].isin(backends)]
|
| 71 |
+
|
| 72 |
+
# Handle device filtering
|
| 73 |
+
if device != "All" and "Device" in filtered_df.columns:
|
| 74 |
+
filtered_df = filtered_df[filtered_df["Device"] == device]
|
| 75 |
+
|
| 76 |
+
return filtered_df
|
| 77 |
+
|
| 78 |
+
# Add clickable links for whisper models too
|
| 79 |
+
for col in whisper_df.columns:
|
| 80 |
+
if col == "model":
|
| 81 |
+
whisper_df[col] = whisper_df[col].apply(lambda x: x.replace(x, make_clickable_model(x)))
|
| 82 |
+
else:
|
| 83 |
+
whisper_df[col] = whisper_df[col].apply(formatter)
|
| 84 |
+
|
| 85 |
original_df.rename(columns=column_names, inplace=True)
|
| 86 |
original_df.sort_values(by='Average WER ⬇️', inplace=True)
|
| 87 |
+
whisper_df.rename(columns=whisper_column_names, inplace=True)
|
| 88 |
+
whisper_df.sort_values(by='Average WER ⬇️', inplace=True)
|
| 89 |
|
| 90 |
COLS = [c.name for c in fields(AutoEvalColumn)]
|
| 91 |
TYPES = [c.type for c in fields(AutoEvalColumn)]
|
|
|
|
| 155 |
interactive=False,
|
| 156 |
visible=True,
|
| 157 |
)
|
| 158 |
+
with gr.TabItem("🔄 Whisper Model Leaderboard", elem_id="whisper-backends-tab", id=1):
|
| 159 |
+
gr.Markdown("## Whisper Model Performance Across Different Backends", elem_classes="markdown-text")
|
| 160 |
+
gr.Markdown("This table shows how different Whisper model implementations compare in terms of performance and speed.", elem_classes="markdown-text")
|
| 161 |
+
|
| 162 |
+
gr.Markdown(
|
| 163 |
+
"""
|
| 164 |
+
* For CUDA tests, we used an **NVIDIA A100-SXM4-40GB GPU** with **CUDA 12.6** with a batch size of 64.
|
| 165 |
+
* For Metal tests, we used a **macOS ARM64 192GB 76-core Mac Studio M2-Ultra** with **macOS 15** with a batch size of 1.
|
| 166 |
+
""",
|
| 167 |
+
elem_classes="markdown-text"
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
with gr.Row():
|
| 171 |
+
backend_filter = gr.Dropdown(
|
| 172 |
+
choices=["All"] + sorted(whisper_df["Backend"].unique().tolist()),
|
| 173 |
+
value="All",
|
| 174 |
+
label="Filter by Backend",
|
| 175 |
+
elem_id="backend-filter",
|
| 176 |
+
multiselect=True,
|
| 177 |
+
)
|
| 178 |
+
device_choices = ["All"] + sorted(whisper_df["Device"].unique().tolist()) if "Device" in whisper_df.columns else ["All"]
|
| 179 |
+
device_filter = gr.Dropdown(
|
| 180 |
+
choices=device_choices,
|
| 181 |
+
value="All",
|
| 182 |
+
label="Filter by Device",
|
| 183 |
+
elem_id="device-filter",
|
| 184 |
+
multiselect=False,
|
| 185 |
+
allow_custom_value=False
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
whisper_table = gr.components.Dataframe(
|
| 189 |
+
value=whisper_df,
|
| 190 |
+
datatype=TYPES,
|
| 191 |
+
elem_id="whisper-table",
|
| 192 |
+
interactive=False,
|
| 193 |
+
visible=True,
|
| 194 |
+
)
|
| 195 |
|
| 196 |
+
backend_filter.change(
|
| 197 |
+
filter_whisper_table,
|
| 198 |
+
inputs=[backend_filter, device_filter],
|
| 199 |
+
outputs=whisper_table
|
| 200 |
+
)
|
| 201 |
+
device_filter.change(
|
| 202 |
+
filter_whisper_table,
|
| 203 |
+
inputs=[backend_filter, device_filter],
|
| 204 |
+
outputs=whisper_table
|
| 205 |
+
)
|
| 206 |
+
with gr.TabItem("📈 Metrics", elem_id="od-benchmark-tab-table", id=2):
|
| 207 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
| 208 |
|
| 209 |
+
with gr.TabItem("✉️✨ Request a model here!", elem_id="od-benchmark-tab-table", id=3):
|
| 210 |
with gr.Column():
|
| 211 |
gr.Markdown("# ✉️✨ Request results for a new model here!", elem_classes="markdown-text")
|
| 212 |
with gr.Column():
|
|
|
|
| 220 |
btn_submitt.click(request_model,
|
| 221 |
[model_name_textbox, chb_coco2017],
|
| 222 |
mdw_submission_result)
|
| 223 |
+
# add an about section
|
| 224 |
+
with gr.TabItem("🤗 About", elem_id="od-benchmark-tab-table", id=4):
|
| 225 |
+
gr.Markdown("## About", elem_classes="markdown-text")
|
| 226 |
|
| 227 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
| 228 |
|
init.py
CHANGED
|
@@ -5,7 +5,9 @@ from huggingface_hub import HfApi, Repository
|
|
| 5 |
|
| 6 |
TOKEN_HUB = os.environ.get("TOKEN_HUB", None)
|
| 7 |
QUEUE_REPO = os.environ.get("QUEUE_REPO", None)
|
|
|
|
| 8 |
QUEUE_PATH = os.environ.get("QUEUE_PATH", None)
|
|
|
|
| 9 |
|
| 10 |
hf_api = HfApi(
|
| 11 |
endpoint="https://huggingface.co",
|
|
@@ -29,6 +31,14 @@ def load_all_info_from_dataset_hub():
|
|
| 29 |
repo_type="dataset",
|
| 30 |
)
|
| 31 |
eval_queue_repo.git_pull()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# Local directory where dataset repo is cloned + folder with eval requests
|
| 34 |
directory = QUEUE_PATH / EVAL_REQUESTS_PATH
|
|
@@ -38,10 +48,13 @@ def load_all_info_from_dataset_hub():
|
|
| 38 |
csv_results = get_csv_with_results(QUEUE_PATH)
|
| 39 |
if csv_results is None:
|
| 40 |
passed = False
|
|
|
|
|
|
|
|
|
|
| 41 |
if not passed:
|
| 42 |
raise ValueError("No Hugging Face token provided. Skipping evaluation requests and results.")
|
| 43 |
|
| 44 |
-
return eval_queue_repo, requested_models, csv_results
|
| 45 |
|
| 46 |
|
| 47 |
def upload_file(requested_model_name, path_or_fileobj):
|
|
|
|
| 5 |
|
| 6 |
TOKEN_HUB = os.environ.get("TOKEN_HUB", None)
|
| 7 |
QUEUE_REPO = os.environ.get("QUEUE_REPO", None)
|
| 8 |
+
QUEUE_REPO_WHISPER = os.environ.get("QUEUE_REPO_WHISPER", None)
|
| 9 |
QUEUE_PATH = os.environ.get("QUEUE_PATH", None)
|
| 10 |
+
QUEUE_PATH_WHISPER = os.environ.get("QUEUE_PATH_WHISPER", None)
|
| 11 |
|
| 12 |
hf_api = HfApi(
|
| 13 |
endpoint="https://huggingface.co",
|
|
|
|
| 31 |
repo_type="dataset",
|
| 32 |
)
|
| 33 |
eval_queue_repo.git_pull()
|
| 34 |
+
|
| 35 |
+
whisper_eval_queue_repo = Repository(
|
| 36 |
+
local_dir=QUEUE_PATH_WHISPER,
|
| 37 |
+
clone_from=QUEUE_REPO_WHISPER,
|
| 38 |
+
use_auth_token=TOKEN_HUB,
|
| 39 |
+
repo_type="dataset",
|
| 40 |
+
)
|
| 41 |
+
whisper_eval_queue_repo.git_pull()
|
| 42 |
|
| 43 |
# Local directory where dataset repo is cloned + folder with eval requests
|
| 44 |
directory = QUEUE_PATH / EVAL_REQUESTS_PATH
|
|
|
|
| 48 |
csv_results = get_csv_with_results(QUEUE_PATH)
|
| 49 |
if csv_results is None:
|
| 50 |
passed = False
|
| 51 |
+
whisper_csv_results = get_csv_with_results(QUEUE_PATH_WHISPER)
|
| 52 |
+
if whisper_csv_results is None:
|
| 53 |
+
passed = False
|
| 54 |
if not passed:
|
| 55 |
raise ValueError("No Hugging Face token provided. Skipping evaluation requests and results.")
|
| 56 |
|
| 57 |
+
return eval_queue_repo, requested_models, csv_results, whisper_eval_queue_repo, whisper_csv_results
|
| 58 |
|
| 59 |
|
| 60 |
def upload_file(requested_model_name, path_or_fileobj):
|