Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Adding Phi-4-Multimodal
#32
by
Steveeeeeeen
HF Staff
- opened
- app.py +9 -259
- constants.py +1 -31
- init.py +1 -51
- utils_display.py +1 -41
app.py
CHANGED
@@ -1,17 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
import json
|
4 |
-
from constants import BANNER, INTRODUCTION_TEXT, CITATION_TEXT, METRICS_TAB_TEXT, DIR_OUTPUT_REQUESTS, LEADERBOARD_CSS
|
5 |
from init import is_model_on_hub, upload_file, load_all_info_from_dataset_hub
|
6 |
-
from utils_display import AutoEvalColumn,
|
7 |
-
import numpy as np
|
8 |
from datetime import datetime, timezone
|
9 |
|
10 |
-
LAST_UPDATED = "
|
11 |
-
|
12 |
-
# Global variable to store detailed benchmark data
|
13 |
-
benchmark_details = {}
|
14 |
-
expanded_languages = set() # Track which languages are expanded
|
15 |
|
16 |
column_names = {
|
17 |
"MODEL": "Model",
|
@@ -27,18 +22,18 @@ column_names = {
|
|
27 |
"Voxpopuli WER": "Voxpopuli",
|
28 |
}
|
29 |
|
30 |
-
eval_queue_repo, requested_models, csv_results
|
31 |
|
32 |
if not csv_results.exists():
|
33 |
raise Exception(f"CSV file {csv_results} does not exist locally")
|
|
|
34 |
# Get csv with data and parse columns
|
35 |
original_df = pd.read_csv(csv_results)
|
|
|
36 |
# Formats the columns
|
37 |
def formatter(x):
|
38 |
if type(x) is str:
|
39 |
x = x
|
40 |
-
elif x == -1:
|
41 |
-
x = "NA"
|
42 |
else:
|
43 |
x = round(x, 2)
|
44 |
return x
|
@@ -48,183 +43,13 @@ for col in original_df.columns:
|
|
48 |
original_df[col] = original_df[col].apply(lambda x: x.replace(x, make_clickable_model(x)))
|
49 |
else:
|
50 |
original_df[col] = original_df[col].apply(formatter) # For numerical values
|
|
|
51 |
original_df.rename(columns=column_names, inplace=True)
|
52 |
original_df.sort_values(by='Average WER โฌ๏ธ', inplace=True)
|
53 |
|
54 |
COLS = [c.name for c in fields(AutoEvalColumn)]
|
55 |
TYPES = [c.type for c in fields(AutoEvalColumn)]
|
56 |
|
57 |
-
# Multilingual columns (dynamic based on expansion state)
|
58 |
-
MULTILINGUAL_COLS = [c.name for c in fields(MultilingualColumn)]
|
59 |
-
|
60 |
-
def create_multilingual_dataframe():
|
61 |
-
"""Create multilingual dataframe with CoVoST, MLS, and FLEURS benchmark data"""
|
62 |
-
global benchmark_details, expanded_languages
|
63 |
-
|
64 |
-
if multilingual_csv_path is None or not multilingual_csv_path.exists():
|
65 |
-
raise Exception("Multilingual CSV file not found")
|
66 |
-
|
67 |
-
# Load CSV data
|
68 |
-
multilingual_raw_df = pd.read_csv(multilingual_csv_path)
|
69 |
-
|
70 |
-
# Store detailed benchmark data for click functionality
|
71 |
-
benchmark_details = {}
|
72 |
-
|
73 |
-
multilingual_data = []
|
74 |
-
for _, row_data in multilingual_raw_df.iterrows():
|
75 |
-
model_name = row_data['model']
|
76 |
-
model_details = {}
|
77 |
-
row = {"Model": make_clickable_model(model_name)}
|
78 |
-
|
79 |
-
# Process data for each language and collect all individual datapoints
|
80 |
-
all_datapoints = [] # Collect all individual dataset scores across all languages
|
81 |
-
|
82 |
-
for lang_code, lang_info in EU_LANGUAGES.items():
|
83 |
-
# Get individual benchmark scores from CSV, using None for missing values
|
84 |
-
# Special cases: de doesn't have MLS, pt doesn't have CoVoST
|
85 |
-
if lang_code == "pt":
|
86 |
-
covost_score = None # pt doesn't have CoVoST data
|
87 |
-
else:
|
88 |
-
covost_score = row_data.get(f"{lang_code}_covost", None)
|
89 |
-
|
90 |
-
if lang_code == "de":
|
91 |
-
mls_score = None # de doesn't have MLS data
|
92 |
-
else:
|
93 |
-
mls_score = row_data.get(f"{lang_code}_mls", None)
|
94 |
-
|
95 |
-
fleurs_score = row_data.get(f"{lang_code}_fleurs", None)
|
96 |
-
|
97 |
-
# Convert string zeros or empty values to None
|
98 |
-
for score_name, score_val in [("covost", covost_score), ("mls", mls_score), ("fleurs", fleurs_score)]:
|
99 |
-
if score_val is not None and (score_val == 0.0 or score_val == "" or str(score_val).strip() == "0" or str(score_val).strip() == ""):
|
100 |
-
if score_name == "covost":
|
101 |
-
covost_score = None
|
102 |
-
elif score_name == "mls":
|
103 |
-
mls_score = None
|
104 |
-
elif score_name == "fleurs":
|
105 |
-
fleurs_score = None
|
106 |
-
|
107 |
-
# Add individual datapoints to the global list
|
108 |
-
if covost_score is not None and covost_score > 0:
|
109 |
-
all_datapoints.append(covost_score)
|
110 |
-
if mls_score is not None and mls_score > 0:
|
111 |
-
all_datapoints.append(mls_score)
|
112 |
-
if fleurs_score is not None and fleurs_score > 0:
|
113 |
-
all_datapoints.append(fleurs_score)
|
114 |
-
|
115 |
-
# Calculate average only from available scores for this language (for display)
|
116 |
-
available_scores = [s for s in [covost_score, mls_score, fleurs_score] if s is not None and s > 0]
|
117 |
-
if available_scores:
|
118 |
-
avg_score = round(sum(available_scores) / len(available_scores), 2)
|
119 |
-
else:
|
120 |
-
avg_score = None
|
121 |
-
|
122 |
-
# Store individual scores for detailed view (only store existing datasets)
|
123 |
-
lang_data = {"average": avg_score if avg_score is not None else "NA"}
|
124 |
-
|
125 |
-
# Only store datasets that exist for this language
|
126 |
-
if lang_code != "pt" and covost_score is not None: # pt doesn't have CoVoST
|
127 |
-
lang_data["CoVoST"] = covost_score
|
128 |
-
if lang_code != "de" and mls_score is not None: # de doesn't have MLS
|
129 |
-
lang_data["MLS"] = mls_score
|
130 |
-
if fleurs_score is not None: # All languages have FLEURS
|
131 |
-
lang_data["FLEURS"] = fleurs_score
|
132 |
-
|
133 |
-
model_details[lang_code] = lang_data
|
134 |
-
|
135 |
-
# Calculate overall multilingual average from all individual datapoints
|
136 |
-
if all_datapoints:
|
137 |
-
row["Average WER โฌ๏ธ"] = round(np.mean(all_datapoints), 2)
|
138 |
-
else:
|
139 |
-
row["Average WER โฌ๏ธ"] = 0.0
|
140 |
-
|
141 |
-
# Add RTFx from the CSV (it should be a single value per model)
|
142 |
-
rtfx_value = row_data.get("rtfx", row_data.get("RTFx", 0.0))
|
143 |
-
# Convert 0 or -1 values to "NA" like in the English leaderboard
|
144 |
-
if rtfx_value == 0.0 or rtfx_value == -1 or rtfx_value == 0 or rtfx_value == "0" or rtfx_value == "0.0":
|
145 |
-
row["RTFx โฌ๏ธ๏ธ"] = "NA"
|
146 |
-
else:
|
147 |
-
row["RTFx โฌ๏ธ๏ธ"] = rtfx_value
|
148 |
-
|
149 |
-
# Add language columns based on expansion state
|
150 |
-
for lang_code, lang_info in EU_LANGUAGES.items():
|
151 |
-
lang_col_name = f"{lang_info['flag']} {lang_info['name']}"
|
152 |
-
model_data = model_details[lang_code]
|
153 |
-
|
154 |
-
if lang_code in expanded_languages:
|
155 |
-
# Show average column AND detailed columns
|
156 |
-
row[f"{lang_col_name} Avg"] = model_data["average"]
|
157 |
-
|
158 |
-
# Only show columns for datasets that actually exist in the data
|
159 |
-
if "CoVoST" in model_data:
|
160 |
-
row[f"{lang_col_name} CoVoST"] = model_data["CoVoST"]
|
161 |
-
if "MLS" in model_data:
|
162 |
-
row[f"{lang_col_name} MLS"] = model_data["MLS"]
|
163 |
-
if "FLEURS" in model_data:
|
164 |
-
row[f"{lang_col_name} FLEURS"] = model_data["FLEURS"]
|
165 |
-
else:
|
166 |
-
# Show only average column
|
167 |
-
row[lang_col_name] = model_data["average"]
|
168 |
-
|
169 |
-
# Store model details for click functionality
|
170 |
-
benchmark_details[model_name] = model_details
|
171 |
-
multilingual_data.append(row)
|
172 |
-
|
173 |
-
multilingual_df = pd.DataFrame(multilingual_data)
|
174 |
-
multilingual_df = multilingual_df.sort_values(by='Average WER โฌ๏ธ')
|
175 |
-
return multilingual_df
|
176 |
-
|
177 |
-
def get_multilingual_datatypes(df):
|
178 |
-
"""Generate appropriate datatypes for multilingual dataframe columns"""
|
179 |
-
datatypes = []
|
180 |
-
for col in df.columns:
|
181 |
-
if col == "Model":
|
182 |
-
datatypes.append("markdown") # This allows HTML rendering
|
183 |
-
else:
|
184 |
-
datatypes.append("number")
|
185 |
-
return datatypes
|
186 |
-
|
187 |
-
def get_language_details(model, language_code):
|
188 |
-
"""Get detailed breakdown for a specific model and language"""
|
189 |
-
global benchmark_details
|
190 |
-
|
191 |
-
if model not in benchmark_details or language_code not in benchmark_details[model]:
|
192 |
-
return None
|
193 |
-
|
194 |
-
language_info = EU_LANGUAGES.get(language_code, {})
|
195 |
-
language_name = language_info.get("name", "Unknown")
|
196 |
-
model_data = benchmark_details[model][language_code]
|
197 |
-
|
198 |
-
details = {
|
199 |
-
"Language": f"{language_info.get('flag', '')} {language_name}",
|
200 |
-
"Model": model,
|
201 |
-
"CoVoST WER": model_data["CoVoST"],
|
202 |
-
"MLS WER": model_data["MLS"],
|
203 |
-
"FLEURS WER": model_data["FLEURS"],
|
204 |
-
"Average WER": model_data["average"]
|
205 |
-
}
|
206 |
-
|
207 |
-
return details
|
208 |
-
|
209 |
-
def toggle_language_expansion(language_code):
|
210 |
-
"""Toggle expansion of language columns when button is clicked"""
|
211 |
-
global expanded_languages
|
212 |
-
|
213 |
-
# Toggle expansion state
|
214 |
-
if language_code in expanded_languages:
|
215 |
-
expanded_languages.remove(language_code)
|
216 |
-
else:
|
217 |
-
expanded_languages.add(language_code)
|
218 |
-
|
219 |
-
# Recreate dataframe with new expansion state
|
220 |
-
updated_df = create_multilingual_dataframe()
|
221 |
-
updated_datatypes = get_multilingual_datatypes(updated_df)
|
222 |
-
|
223 |
-
return gr.update(value=updated_df, datatype=updated_datatypes)
|
224 |
-
|
225 |
-
# Initialize multilingual dataframe
|
226 |
-
multilingual_df = create_multilingual_dataframe()
|
227 |
-
|
228 |
|
229 |
def request_model(model_text, chbcoco2017):
|
230 |
|
@@ -277,16 +102,6 @@ def request_model(model_text, chbcoco2017):
|
|
277 |
except Exception as e:
|
278 |
return styled_error(f"Error submitting request!")
|
279 |
|
280 |
-
def filter_main_table(show_proprietary=True):
|
281 |
-
filtered_df = original_df.copy()
|
282 |
-
|
283 |
-
# Filter proprietary models if needed
|
284 |
-
if not show_proprietary and "License" in filtered_df.columns:
|
285 |
-
# Keep only models with "Open" license
|
286 |
-
filtered_df = filtered_df[filtered_df["License"] == "Open"]
|
287 |
-
|
288 |
-
return filtered_df
|
289 |
-
|
290 |
with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
291 |
gr.HTML(BANNER, elem_id="banner")
|
292 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
@@ -299,74 +114,12 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
299 |
elem_id="leaderboard-table",
|
300 |
interactive=False,
|
301 |
visible=True,
|
302 |
-
)
|
303 |
-
with gr.Row():
|
304 |
-
show_proprietary_checkbox = gr.Checkbox(
|
305 |
-
label="Show proprietary models",
|
306 |
-
value=True,
|
307 |
-
elem_id="show-proprietary-checkbox"
|
308 |
-
)
|
309 |
-
|
310 |
-
# Connect checkbox to the filtering function
|
311 |
-
show_proprietary_checkbox.change(
|
312 |
-
filter_main_table,
|
313 |
-
inputs=[show_proprietary_checkbox],
|
314 |
-
outputs=leaderboard_table
|
315 |
-
)
|
316 |
-
|
317 |
-
with gr.TabItem("๐ Multilingual", elem_id="multilingual-benchmark-tab-table", id=1):
|
318 |
-
gr.Markdown(MULTILINGUAL_TAB_TEXT, elem_classes="markdown-text")
|
319 |
-
|
320 |
-
# Language toggle buttons
|
321 |
-
gr.Markdown("Click on a language button to show/hide detailed benchmark scores (CoVoST, MLS, FLEURS):")
|
322 |
-
|
323 |
-
language_buttons = {}
|
324 |
-
lang_codes = list(EU_LANGUAGES.keys())
|
325 |
-
|
326 |
-
# First row of buttons (5 languages)
|
327 |
-
with gr.Row():
|
328 |
-
for lang_code in lang_codes[:5]:
|
329 |
-
lang_info = EU_LANGUAGES[lang_code]
|
330 |
-
button_label = f"{lang_info['flag']} {lang_info['name']}"
|
331 |
-
language_buttons[lang_code] = gr.Button(
|
332 |
-
button_label,
|
333 |
-
variant="secondary",
|
334 |
-
size="sm"
|
335 |
-
)
|
336 |
-
|
337 |
-
# Second row of buttons (remaining 5 languages)
|
338 |
-
with gr.Row():
|
339 |
-
for lang_code in lang_codes[5:]:
|
340 |
-
lang_info = EU_LANGUAGES[lang_code]
|
341 |
-
button_label = f"{lang_info['flag']} {lang_info['name']}"
|
342 |
-
language_buttons[lang_code] = gr.Button(
|
343 |
-
button_label,
|
344 |
-
variant="secondary",
|
345 |
-
size="sm"
|
346 |
-
)
|
347 |
-
|
348 |
-
multilingual_table = gr.components.Dataframe(
|
349 |
-
value=multilingual_df,
|
350 |
-
datatype=get_multilingual_datatypes(multilingual_df),
|
351 |
-
elem_id="multilingual-table",
|
352 |
-
interactive=False,
|
353 |
-
visible=True,
|
354 |
-
)
|
355 |
-
|
356 |
-
# Connect buttons to toggle language expansion
|
357 |
-
for lang_code, button in language_buttons.items():
|
358 |
-
def create_toggle_func(code):
|
359 |
-
return lambda: toggle_language_expansion(code)
|
360 |
-
|
361 |
-
button.click(
|
362 |
-
create_toggle_func(lang_code),
|
363 |
-
outputs=[multilingual_table]
|
364 |
)
|
365 |
|
366 |
-
with gr.TabItem("๐ Metrics", elem_id="od-benchmark-tab-table", id=
|
367 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
368 |
|
369 |
-
with gr.TabItem("โ๏ธโจ Request a model here!", elem_id="od-benchmark-tab-table", id=
|
370 |
with gr.Column():
|
371 |
gr.Markdown("# โ๏ธโจ Request results for a new model here!", elem_classes="markdown-text")
|
372 |
with gr.Column():
|
@@ -380,9 +133,6 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
380 |
btn_submitt.click(request_model,
|
381 |
[model_name_textbox, chb_coco2017],
|
382 |
mdw_submission_result)
|
383 |
-
# add an about section
|
384 |
-
with gr.TabItem("๐ค About", elem_id="od-benchmark-tab-table", id=5):
|
385 |
-
gr.Markdown("## About", elem_classes="markdown-text")
|
386 |
|
387 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
388 |
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
import json
|
4 |
+
from constants import BANNER, INTRODUCTION_TEXT, CITATION_TEXT, METRICS_TAB_TEXT, DIR_OUTPUT_REQUESTS, LEADERBOARD_CSS
|
5 |
from init import is_model_on_hub, upload_file, load_all_info_from_dataset_hub
|
6 |
+
from utils_display import AutoEvalColumn, fields, make_clickable_model, styled_error, styled_message
|
|
|
7 |
from datetime import datetime, timezone
|
8 |
|
9 |
+
LAST_UPDATED = "Nov 22th 2024"
|
|
|
|
|
|
|
|
|
10 |
|
11 |
column_names = {
|
12 |
"MODEL": "Model",
|
|
|
22 |
"Voxpopuli WER": "Voxpopuli",
|
23 |
}
|
24 |
|
25 |
+
eval_queue_repo, requested_models, csv_results = load_all_info_from_dataset_hub()
|
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:
|
36 |
x = x
|
|
|
|
|
37 |
else:
|
38 |
x = round(x, 2)
|
39 |
return x
|
|
|
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)]
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
def request_model(model_text, chbcoco2017):
|
55 |
|
|
|
102 |
except Exception as e:
|
103 |
return styled_error(f"Error submitting request!")
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
106 |
gr.HTML(BANNER, elem_id="banner")
|
107 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
|
|
114 |
elem_id="leaderboard-table",
|
115 |
interactive=False,
|
116 |
visible=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
)
|
118 |
|
119 |
+
with gr.TabItem("๐ Metrics", elem_id="od-benchmark-tab-table", id=1):
|
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=2):
|
123 |
with gr.Column():
|
124 |
gr.Markdown("# โ๏ธโจ Request results for a new model here!", elem_classes="markdown-text")
|
125 |
with gr.Column():
|
|
|
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 |
|
constants.py
CHANGED
@@ -17,7 +17,7 @@ INTRODUCTION_TEXT = "๐ The ๐ค Open ASR Leaderboard ranks and evaluates spee
|
|
17 |
on the Hugging Face Hub. \
|
18 |
\nWe report the Average [WER](https://huggingface.co/spaces/evaluate-metric/wer) (โฌ๏ธ lower the better) and [RTFx](https://github.com/NVIDIA/DeepLearningExamples/blob/master/Kaldi/SpeechRecognition/README.md#metrics) (โฌ๏ธ higher the better). Models are ranked based on their Average WER, from lowest to highest. Check the ๐ Metrics tab to understand how the models are evaluated. \
|
19 |
\nIf you want results for a model that is not listed here, you can submit a request for it to be included โ๏ธโจ. \
|
20 |
-
\nThe leaderboard
|
21 |
|
22 |
CITATION_TEXT = """@misc{open-asr-leaderboard,
|
23 |
title = {Open Automatic Speech Recognition Leaderboard},
|
@@ -114,38 +114,8 @@ are ranked based on their average WER scores, from lowest to highest.
|
|
114 |
For more details on the individual datasets and how models are evaluated to give the ESB score, refer to the [ESB paper](https://arxiv.org/abs/2210.13352).
|
115 |
"""
|
116 |
|
117 |
-
# Multilingual benchmark definitions
|
118 |
-
EU_LANGUAGES = {
|
119 |
-
"de": {"name": "German", "flag": "๐ฉ๐ช", "datasets": ["mls", "fleurs", "covost"]},
|
120 |
-
"fr": {"name": "French", "flag": "๐ซ๐ท", "datasets": ["mls", "fleurs", "covost"]},
|
121 |
-
"it": {"name": "Italian", "flag": "๐ฎ๐น", "datasets": ["mls", "fleurs", "covost"]},
|
122 |
-
"es": {"name": "Spanish", "flag": "๐ช๐ธ", "datasets": ["mls", "fleurs", "covost"]},
|
123 |
-
"pt": {"name": "Portuguese", "flag": "๐ต๐น", "datasets": ["mls", "fleurs", "covost"]}
|
124 |
-
}
|
125 |
-
|
126 |
-
MULTILINGUAL_TAB_TEXT = """
|
127 |
-
## ๐ Multilingual ASR Evaluation
|
128 |
-
|
129 |
-
"""
|
130 |
-
|
131 |
LEADERBOARD_CSS = """
|
132 |
#leaderboard-table th .header-content {
|
133 |
white-space: nowrap;
|
134 |
}
|
135 |
-
|
136 |
-
#multilingual-table th .header-content {
|
137 |
-
white-space: nowrap;
|
138 |
-
}
|
139 |
-
|
140 |
-
#multilingual-table th:hover {
|
141 |
-
background-color: var(--table-row-focus);
|
142 |
-
}
|
143 |
-
|
144 |
-
.language-detail-modal {
|
145 |
-
background: var(--background-fill-primary);
|
146 |
-
border: 1px solid var(--border-color-primary);
|
147 |
-
border-radius: 8px;
|
148 |
-
padding: 1rem;
|
149 |
-
margin: 1rem 0;
|
150 |
-
}
|
151 |
"""
|
|
|
17 |
on the Hugging Face Hub. \
|
18 |
\nWe report the Average [WER](https://huggingface.co/spaces/evaluate-metric/wer) (โฌ๏ธ lower the better) and [RTFx](https://github.com/NVIDIA/DeepLearningExamples/blob/master/Kaldi/SpeechRecognition/README.md#metrics) (โฌ๏ธ higher the better). Models are ranked based on their Average WER, from lowest to highest. Check the ๐ Metrics tab to understand how the models are evaluated. \
|
19 |
\nIf you want results for a model that is not listed here, you can submit a request for it to be included โ๏ธโจ. \
|
20 |
+
\nThe leaderboard currently focuses on English speech recognition, and will be expanded to multilingual evaluation in later versions."
|
21 |
|
22 |
CITATION_TEXT = """@misc{open-asr-leaderboard,
|
23 |
title = {Open Automatic Speech Recognition Leaderboard},
|
|
|
114 |
For more details on the individual datasets and how models are evaluated to give the ESB score, refer to the [ESB paper](https://arxiv.org/abs/2210.13352).
|
115 |
"""
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
LEADERBOARD_CSS = """
|
118 |
#leaderboard-table th .header-content {
|
119 |
white-space: nowrap;
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
"""
|
init.py
CHANGED
@@ -5,9 +5,7 @@ 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_REPO_MULTI = os.environ.get("QUEUE_REPO_MULTI", None)
|
9 |
QUEUE_PATH = os.environ.get("QUEUE_PATH", None)
|
10 |
-
QUEUE_PATH_MULTI = os.environ.get("QUEUE_PATH_MULTI", None)
|
11 |
|
12 |
hf_api = HfApi(
|
13 |
endpoint="https://huggingface.co",
|
@@ -43,43 +41,7 @@ def load_all_info_from_dataset_hub():
|
|
43 |
if not passed:
|
44 |
raise ValueError("No Hugging Face token provided. Skipping evaluation requests and results.")
|
45 |
|
46 |
-
|
47 |
-
multilingual_csv_results = load_multilingual_data()
|
48 |
-
|
49 |
-
return eval_queue_repo, requested_models, csv_results, multilingual_csv_results
|
50 |
-
|
51 |
-
def load_multilingual_data():
|
52 |
-
"""Load multilingual evaluation data from CSV"""
|
53 |
-
multilingual_queue_path = QUEUE_PATH_MULTI
|
54 |
-
|
55 |
-
try:
|
56 |
-
# Try to get from dedicated multilingual HF repo first
|
57 |
-
if TOKEN_HUB is not None:
|
58 |
-
print("Pulling multilingual evaluation data.")
|
59 |
-
try:
|
60 |
-
multilingual_repo = Repository(
|
61 |
-
local_dir=multilingual_queue_path,
|
62 |
-
clone_from=QUEUE_REPO_MULTI,
|
63 |
-
use_auth_token=TOKEN_HUB,
|
64 |
-
repo_type="dataset",
|
65 |
-
)
|
66 |
-
multilingual_repo.git_pull()
|
67 |
-
multilingual_csv = get_multilingual_csv_with_results(multilingual_queue_path)
|
68 |
-
except Exception as e:
|
69 |
-
print(f"Failed to pull from multilingual repo: {e}")
|
70 |
-
multilingual_csv = None
|
71 |
-
else:
|
72 |
-
multilingual_csv = None
|
73 |
-
|
74 |
-
# Fallback to local file
|
75 |
-
if multilingual_csv is None:
|
76 |
-
print("Using local multilingual CSV file.")
|
77 |
-
multilingual_csv = get_multilingual_csv_with_results(".")
|
78 |
-
|
79 |
-
return multilingual_csv
|
80 |
-
except Exception as e:
|
81 |
-
print(f"Error loading multilingual data: {e}")
|
82 |
-
return None
|
83 |
|
84 |
|
85 |
def upload_file(requested_model_name, path_or_fileobj):
|
@@ -106,18 +68,6 @@ def get_csv_with_results(directory):
|
|
106 |
return None
|
107 |
return latest[0]
|
108 |
|
109 |
-
def get_multilingual_csv_with_results(directory):
|
110 |
-
"""Get multilingual CSV results file"""
|
111 |
-
directory = Path(directory)
|
112 |
-
multilingual_csv_files = list(directory.glob("multilingual_results_latest.csv"))
|
113 |
-
if len(multilingual_csv_files) != 1:
|
114 |
-
# Try local directory as fallback
|
115 |
-
local_multilingual = Path("multilingual_results_latest.csv")
|
116 |
-
if local_multilingual.exists():
|
117 |
-
return local_multilingual
|
118 |
-
return None
|
119 |
-
return multilingual_csv_files[0]
|
120 |
-
|
121 |
|
122 |
|
123 |
def is_model_on_hub(model_name, revision="main") -> bool:
|
|
|
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",
|
|
|
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):
|
|
|
68 |
return None
|
69 |
return latest[0]
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
|
73 |
def is_model_on_hub(model_name, revision="main") -> bool:
|
utils_display.py
CHANGED
@@ -24,49 +24,9 @@ class AutoEvalColumn: # Auto evals column
|
|
24 |
tl_wer = ColumnContent("Tedlium", "number")
|
25 |
vp_wer = ColumnContent("Voxpopuli", "number")
|
26 |
|
27 |
-
@dataclass(frozen=True)
|
28 |
-
class MultilingualColumn: # Multilingual benchmark columns
|
29 |
-
model = ColumnContent("Model", "markdown")
|
30 |
-
avg_multilingual = ColumnContent("Average WER โฌ๏ธ", "number")
|
31 |
-
rtf = ColumnContent("RTFx โฌ๏ธ๏ธ", "number")
|
32 |
-
de_avg = ColumnContent("๐ฉ๐ช German", "number")
|
33 |
-
fr_avg = ColumnContent("๐ซ๐ท French", "number")
|
34 |
-
es_avg = ColumnContent("๐ช๐ธ Spanish", "number")
|
35 |
-
it_avg = ColumnContent("๐ฎ๐น Italian", "number")
|
36 |
-
nl_avg = ColumnContent("๐ณ๐ฑ Dutch", "number")
|
37 |
-
pl_avg = ColumnContent("๐ต๐ฑ Polish", "number")
|
38 |
-
pt_avg = ColumnContent("๐ต๐น Portuguese", "number")
|
39 |
-
cs_avg = ColumnContent("๐จ๐ฟ Czech", "number")
|
40 |
-
ro_avg = ColumnContent("๐ท๐ด Romanian", "number")
|
41 |
-
hu_avg = ColumnContent("๐ญ๐บ Hungarian", "number")
|
42 |
-
|
43 |
|
44 |
def make_clickable_model(model_name):
|
45 |
-
|
46 |
-
if model_name_list[0] == "trt-llm":
|
47 |
-
link = "https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/whisper"
|
48 |
-
elif model_name_list[0] == "faster-whisper":
|
49 |
-
link = "https://github.com/guillaumekln/faster-whisper"
|
50 |
-
elif model_name_list[0] == "Whisper.cpp":
|
51 |
-
link = "https://github.com/ggerganov/whisper.cpp"
|
52 |
-
elif model_name_list[0] == "WhisperKit":
|
53 |
-
link = "https://github.com/argmaxinc/WhisperKit"
|
54 |
-
elif model_name_list[0] == "WhisperMLX":
|
55 |
-
link = "https://huggingface.co/collections/mlx-community/whisper-663256f9964fbb1177db93dc"
|
56 |
-
elif model_name_list[0] == "elevenlabs":
|
57 |
-
link = "https://elevenlabs.io/speech-to-text"
|
58 |
-
elif model_name_list[0] == "openai" and (model_name_list[1] == "whisper-1" or model_name_list[1] == "gpt-4o-transcribe" or model_name_list[1] == "gpt-4o-mini-transcribe"):
|
59 |
-
link = "https://platform.openai.com/docs/guides/speech-to-text"
|
60 |
-
elif model_name_list[0] == "assemblyai":
|
61 |
-
link = "https://www.assemblyai.com/docs"
|
62 |
-
elif model_name_list[0] == "revai":
|
63 |
-
link = "https://docs.rev.ai/api/asynchronous/get-started/"
|
64 |
-
elif model_name_list[0] == "speechmatics":
|
65 |
-
link = "https://www.speechmatics.com/"
|
66 |
-
elif model_name_list[0] == "ultravox":
|
67 |
-
link = "https://huggingface.co/fixie-ai"
|
68 |
-
else:
|
69 |
-
link = f"https://huggingface.co/{model_name}"
|
70 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
71 |
|
72 |
def styled_error(error):
|
|
|
24 |
tl_wer = ColumnContent("Tedlium", "number")
|
25 |
vp_wer = ColumnContent("Voxpopuli", "number")
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
def make_clickable_model(model_name):
|
29 |
+
link = f"https://huggingface.co/{model_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
31 |
|
32 |
def styled_error(error):
|