Evaluation scripts for the Open TTS Leaderboard: https://huggingface.co/spaces/hf-audio/open_tts_leaderboard
Python
Add UTMOS (#4)
mrfakenamee77585d25aa2
diff --git a/README.md b/README.mdindex 32c13a3..fc274df 100644--- a/README.md+++ b/README.md@@ -13,6 +13,7 @@ While human preference is the ultimate decider, **arenas cannot scale to keep up1. **Intelligibility**: word/character error rate (WER and CER) between the target text and the generated audio's transcript, using [Qwen3 ASR](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf) (top ranking open-source model on the [Open ASR Leaderboard](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard)).2. **Speed**: inverse real-time factor (RTFx) for batched offline inference on an H200 GPU, and time-to-first-audio (TTFA) for quantifying streaming batch size 1 latency on an A100 GPU and CPU.3. **Speaker similarity** by computing the cosine similarity (SIM) between [WavLM speaker embeddings](https://huggingface.co/bezzam/wavlm_large_finetune_seed_tts_eval) of the generated audio and the reference clip. Note that not all models support voice cloning, so those models are omitted from this evaluation.+4. **Naturalness**: predicted MOS (1-5) with [UTMOS22 strong](https://github.com/tarepan/SpeechMOS) (UTMOS). UTMOS22 is trained on English only, so it is reported for `en` only.By relying on objective metrics **evaluating a model drops from a couple weeks (for collecting votes) to a couple hours** ⚡@@ -23,6 +24,7 @@ Our intention with this leaderboard is for it to be **shaped by the community**;- [Setup for running evaluations](#setup-for-running-evaluations)- [Batch evaluation (main tab)](#batch-evaluation-main-tab)- [Publishing results](#publishing-results)+- [Example costs](#example-costs)- [Adding a new model](#adding-a-new-model)- [Time-to-first audio (streaming) evaluation](#time-to-first-audio-streaming-evaluation)- [Citation](#citation)@@ -103,7 +105,7 @@ facebook/seamless-m4t-v2-large: RTFx = 21.19Each model family has its own folder (e.g. [kokoro/](kokoro/), [voxcpm2/](voxcpm2/), [transformers/](transformers/)) with a `submit_jobs.sh` that is run **locally** and submits HF Jobs to HF servers. The orchestration shared by all backends lives in [scripts/tts_jobs_common.sh](scripts/tts_jobs_common.sh).-For each (model, dataset split) pair, the pipeline runs three sequential HF Jobs (two if the model is not voice cloning), followed by scoring on your machine. The splits of a model run in parallel; models run one after another.+For each (model, dataset split) pair, the pipeline runs four sequential HF Jobs (three if the model is not voice cloning), followed by scoring on your machine. The splits of a model run in parallel; models run one after another.```mermaidflowchart LR@@ -116,34 +118,40 @@ flowchart LRgen["<b>1. Generate</b><br/><backend>/run_eval.py · H200"]asr["<b>2. Transcribe</b><br/>Qwen3-ASR · L4"]sim["<b>3. Speaker similarity</b><br/>WavLM-SV · L4"]+ utmos["<b>4. UTMOS</b><br/>UTMOS22 · L4"]endds[("Private datasets<br/>seed_tts_eval / cv3_eval")]bucket[("RESULTS_BUCKET<br/>wavs + JSONL manifests")]- submit --> gen --> asr -->|voice cloning only| sim+ submit --> gen --> asr -->|voice cloning only| sim --> utmos+ asr --> utmosds --> gengen -->|wavs + manifest| bucketasr <-->|pred_text| bucketsim <-->|sim| bucket+ utmos -->|UTMOS_*.json| bucketbucket -->|manifests only| score```1. **Generate** (`generate`): the backend's `run_eval.py` synthesizes every sample of the split and writes the wavs plus a JSONL manifest to `RESULTS_BUCKET`, in a folder per model.2. **Transcribe** (`transcribe`): [transformers/transcribe.py](transformers/transcribe.py) transcribes the wavs with [Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf), using the split's language as a hint.3. **Speaker similarity** (`sim`, voice cloning only): [transformers/score_similarity.py](transformers/score_similarity.py) compares each generated clip with its reference prompt, using the [Seed TTS Eval](https://github.com/BytedanceSpeech/seed-tts-eval#metrics) speaker-verification model (WavLM-large + ECAPA-TDNN, mirrored [here](https://huggingface.co/bezzam/wavlm_large_finetune_seed_tts_eval)).-4. **Score** (on your machine): the model's manifests are synced to `./results/<model>` and scored per language:+4. **UTMOS** (`utmos`, `UTMOS_LANGS` only): [transformers/score_utmos.py](transformers/score_utmos.py) predicts a MOS for each wav with UTMOS22 strong.+5. **Score** (on your machine): the model's manifests are synced to `./results/<model>` and scored per language:- **WER** after text normalization (CER for `zh`, `ja`, `ko`)- **RTFx**: total audio duration divided by total generation time, measured in stage 1- **SIM**: mean speaker similarity, for voice cloning only+ - **UTMOS**: mean predicted MOS-The stages are separate jobs because the TTS, ASR and speaker-similarity models have conflicting dependencies: stage 1 uses the backend's own Docker Space image, and stages 2 and 3 share [bezzam/evals](https://huggingface.co/spaces/bezzam/evals).+The stages are separate jobs because the TTS, ASR and speaker-similarity models have conflicting dependencies: stage 1 uses the backend's own Docker Space image, and stages 2-4 share [bezzam/evals](https://huggingface.co/spaces/bezzam/evals).| Stage | Flavor | Hardware ||---|---|---|| 1. Generate | `h200` | 1x Nvidia H200 (141 GB) || 2. Transcribe | `l4x1` | 1x Nvidia L4 (24 GB) || 3. Speaker similarity | `l4x1` | 1x Nvidia L4 (24 GB) |+| 4. UTMOS | `l4x1` | 1x Nvidia L4 (24 GB) |RTFx is measured in stage 1, so every model is generated on the **same** flavor (`h200`); don't override `FLAVOR` in a backend. See the [HF Jobs documentation](https://huggingface.co/docs/huggingface_hub/main/en/guides/jobs#select-the-hardware) for pricing.@@ -157,7 +165,7 @@ Useful environment variables (see [scripts/tts_jobs_common.sh](scripts/tts_jobs_| `RESULTS_BUCKET` | `hf-audio/tts_leaderboard_h200` | Bucket the jobs write to || `MAX_EVAL_SAMPLES` | `-1` (all) | Cap samples per split, e.g. `8` for a smoke test || `ONLY_LANGS` | (all) | Only run the configured splits for these languages, e.g. `"en zh"` |-| `STAGES` | `generate transcribe sim` | Subset of stages, e.g. `"transcribe sim"` to re-score existing wavs |+| `STAGES` | `generate transcribe sim utmos` | Subset of stages, e.g. `"transcribe sim"` to re-score existing wavs || `VOICE_CLONE` | `false` | Clone the prompt speaker (backends that support both modes) || `ASR_OVERWRITE` / `SIM_OVERWRITE` | `false` | Recompute `pred_text` / `sim` instead of resuming. **Set `SIM_OVERWRITE=true` after regenerating audio**, otherwise old SIM scores are carried over || `ORG_NAME` | (none) | Run the jobs under an organization's namespace |@@ -188,6 +196,24 @@ python scripts/open_results_pr.py --model_id openbmb/VoxCPM2 \A new versions entry should be set in the HF space code [here](https://huggingface.co/spaces/hf-audio/open_tts_leaderboard/blob/main/leaderboard_data.py#L50).+## Example costs++Full runs on 11 combos (Seed-TTS `en`/`zh` + CV3 `en`/`zh`/`fr`/`es`/`de`/`it`/`ja`/`ko`/`ru`), in October 2026, counting job running time only:++- `facebook/seamless-m4t-v2-large`: Transformers backend, default voice (no SIM), batch size 32+- `k2-fsa/OmniVoice`: voice cloning (`VOICE_CLONE=true`), batch size 32++| Stage | Seamless | OmniVoice (voice cloning) |+|---|---|---|+| 1. Generate (`h200`, $5.00/h) | 11 jobs, 12 min: $1.01 | 11 jobs, 49 min: $4.09 |+| 2. Transcribe (`l4x1`, $0.80/h) | 11 jobs, 25 min: $0.34 | 11 jobs, 26 min: $0.34 |+| 3. Speaker similarity (`l4x1`, $0.80/h) | — | 11 jobs, 43 min: $0.57 |+| 4. UTMOS (`l4x1`, $0.80/h, English only) | 2 jobs, 3 min: $0.04 | 2 jobs, 4 min: $0.05 |+| **Total** | **≈ $1.40** | **≈ $5.05** |++Seamless is fast and batched, so most of each of its generation jobs (~1 min per combo) is image and model loading; OmniVoice takes ~4 min per combo (~8 min for Seed-TTS `zh`, the largest split). Stage 1 scales with the model's speed: a slower model, or one that generates one sample at a time, can cost 10-100x more there. Stages 2-4 scale with the amount of audio, so they stay roughly constant.++## Adding a new model> [!TIP]diff --git a/inflect-nano/submit_jobs.sh b/inflect-nano/submit_jobs.shindex a009584..cc6d277 100644--- a/inflect-nano/submit_jobs.sh+++ b/inflect-nano/submit_jobs.sh@@ -6,7 +6,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-inflect}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-inflect/blob/main/Dockerfile)-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.RUN_EVAL_INJECT="$(inject_run_eval)"diff --git a/inflect-v2/submit_jobs.sh b/inflect-v2/submit_jobs.shindex fc3be9d..c19af3d 100755--- a/inflect-v2/submit_jobs.sh+++ b/inflect-v2/submit_jobs.sh@@ -9,7 +9,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-inflect-v2}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-inflect-v2/blob/main/Dockerfile)-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice, no reference to compare)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice, no reference to compare)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.RUN_EVAL_INJECT="$(inject_run_eval)"diff --git a/kokoro/submit_jobs.sh b/kokoro/submit_jobs.shindex 597c7ec..07c8e04 100755--- a/kokoro/submit_jobs.sh+++ b/kokoro/submit_jobs.sh@@ -7,7 +7,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-kokoro}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-kokoro/blob/main/Dockerfile)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)RUN_EVAL_INJECT="$(inject_run_eval)"# ── Language → (Kokoro lang_code, voice pack) ────────────────────────────────diff --git a/lfm2-audio/submit_jobs.sh b/lfm2-audio/submit_jobs.shindex 7ebd7bd..ede2ec6 100644--- a/lfm2-audio/submit_jobs.sh+++ b/lfm2-audio/submit_jobs.sh@@ -7,7 +7,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-lfm2-audio}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-lfm2-audio/blob/main/Dockerfile)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)RUN_EVAL_INJECT="$(inject_run_eval)"# English only (model card), with four built-in voices: us_female, us_male, uk_female, uk_male.diff --git a/magpie-tts/submit_jobs.sh b/magpie-tts/submit_jobs.shindex 3940911..5fbc46f 100644--- a/magpie-tts/submit_jobs.sh+++ b/magpie-tts/submit_jobs.sh@@ -6,7 +6,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-magpie}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-magpie/blob/main/Dockerfile)-DEFAULT_STAGES="generate transcribe" # no SIM (fixed baked voice, no zero-shot cloning)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed baked voice, no zero-shot cloning)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.RUN_EVAL_INJECT="$(inject_run_eval)"diff --git a/normalizer/eval_utils.py b/normalizer/eval_utils.pyindex d387f82..7e48e6e 100644--- a/normalizer/eval_utils.py+++ b/normalizer/eval_utils.py@@ -187,6 +187,25 @@ def read_manifest(manifest_path: str):# SIM backends that score into their own manifest fork, <manifest>_<backend>.jsonl (keep in sync# with `sim_manifest_path` in transformers/score_similarity.py). `xvector` writes `sim` in place.SIM_BACKEND_SUFFIXES = ("wavlm_seed_tts",)+# UTMOS22 is trained on English only, so it is scored and reported for English only.+UTMOS_LANGUAGES = {"en"}+# Languages that still get a (possibly empty) `<lang> UTMOS` column in the leaderboard CSVs, so+# UTMOS can be enabled for them later without changing the published header.+UTMOS_COLUMN_LANGUAGES = {"en", "zh", "fr"}+++def read_utmos(manifest_path: str, manifest: list):+ """Mean UTMOS from the `UTMOS_<stem>.json` sidecar written by transformers/score_utmos.py."""+ stem = os.path.basename(manifest_path).removesuffix(".jsonl")+ for suffix in SIM_BACKEND_SUFFIXES:+ stem = stem.removesuffix(f"_{suffix}")+ sidecar = os.path.join(os.path.dirname(manifest_path), f"UTMOS_{stem}.json")+ if not os.path.exists(sidecar):+ return None+ with open(sidecar, encoding="utf-8") as f:+ scores = json.load(f)["scores"]+ vals = [v for v in (scores.get(d.get("audio_filepath")) for d in manifest) if isinstance(v, float)]+ return round(sum(vals) / len(vals), 3) if vals else Nonedef score_results(directory: str, model_id: str = None, multilingual: bool = None, csv_only: bool = False, language: str = "en", manifests: list = None, sim_backend: str = "wavlm_seed_tts"):@@ -337,6 +356,7 @@ def score_results(directory: str, model_id: str = None, multilingual: bool = Nonelse:sims = [datum["sim"] for datum in manifest if isinstance(datum.get("sim"), (int, float))]sim = round(100 * sum(sims) / len(sims), 2) if sims else None+ utmos = read_utmos(result_file, manifest) if language in UTMOS_LANGUAGES else Noneif use_cer:# Per-character alignment (merge_compounds is moot). The headline CJK number is the@@ -389,7 +409,7 @@ def score_results(directory: str, model_id: str = None, multilingual: bool = Nonextra = {"ins": total_ins, "del": total_del, "sub": total_sub}# `wer` holds the headline error rate; `metric` says whether it is a WER or a CER. For CJK# it is the lenient CER, with `cer_unnormalized` the seed-tts-eval-comparable number.- results[result_key] = {"wer": wer, "metric": "CER" if use_cer else "WER", "cer_unnormalized": cer_unnormalized, "audio_length": audio_length, "inference_time": inference_time, "rtfx": rtfx, "sim": sim, **extra}+ results[result_key] = {"wer": wer, "metric": "CER" if use_cer else "WER", "cer_unnormalized": cer_unnormalized, "audio_length": audio_length, "inference_time": inference_time, "rtfx": rtfx, "sim": sim, "utmos": utmos, **extra}# Name the manifests whose SIM was dropped, even under csv_only, so a blank SIM is explained.if stale_sim_files:@@ -413,6 +433,8 @@ def score_results(directory: str, model_id: str = None, multilingual: bool = Nonmetrics += f", RTFx = {v['rtfx']:0.2f}"if v.get("sim") is not None:metrics += f", SIM = {v['sim']:0.2f} %"+ if v.get("utmos") is not None:+ metrics += f", UTMOS = {v['utmos']:0.3f}"print(metrics)# composite WER should be computed over all datasets and with the same key@@ -421,6 +443,8 @@ def score_results(directory: str, model_id: str = None, multilingual: bool = Noncomposite_inference_time = defaultdict(float)composite_sim = defaultdict(float)count_sim_entries = defaultdict(int)+ composite_utmos = defaultdict(float)+ count_utmos_entries = defaultdict(int)count_entries = defaultdict(int)composite_metrics = defaultdict(set)for k, v in results.items():@@ -434,6 +458,9 @@ def score_results(directory: str, model_id: str = None, multilingual: bool = Nonif v.get("sim") is not None:composite_sim[key] += v["sim"]count_sim_entries[key] += 1+ if v.get("utmos") is not None:+ composite_utmos[key] += v["utmos"]+ count_utmos_entries[key] += 1count_entries[key] += 1# normalize scores & print@@ -453,6 +480,9 @@ def score_results(directory: str, model_id: str = None, multilingual: bool = Nonfor k in composite_sim:sim = composite_sim[k] / count_sim_entries[k]print(f"{k}: SIM = {sim:0.2f} %")+ for k in composite_utmos:+ utmos = composite_utmos[k] / count_utmos_entries[k]+ print(f"{k}: UTMOS = {utmos:0.3f}")print("*" * 80)return composite_wer, resultsdiff --git a/paradee/submit_jobs.sh b/paradee/submit_jobs.shindex 58b717d..dee1552 100755--- a/paradee/submit_jobs.sh+++ b/paradee/submit_jobs.sh@@ -7,7 +7,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-paradee}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-paradee/blob/main/Dockerfile)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)RUN_EVAL_INJECT="$(inject_run_eval)"# ── Device / threads ─────────────────────────────────────────────────────────diff --git a/scripts/open_results_pr.py b/scripts/open_results_pr.pyindex c89d683..516d1ab 100644--- a/scripts/open_results_pr.py+++ b/scripts/open_results_pr.py@@ -8,10 +8,10 @@ numbers into one row per benchmark file, upserts those rows intoFiles written (all in that dataset repo):model_info.csv metadata -- scoring cannot derive it, so it comes from the CLI flags- seed_tts.csv Seed-TTS-Eval, model's own/default voice (WER, RTFx)- seed_tts_voice_clone.csv Seed-TTS-Eval, cloning each prompt (WER, RTFx, SIM x2)- cv3.csv CV3-Eval, model's own/default voice (WER, RTFx + averages)- cv3_voice_clone.csv CV3-Eval, cloning each prompt (WER, RTFx, SIM + averages)+ seed_tts.csv Seed-TTS-Eval, model's own/default voice (WER, RTFx, UTMOS)+ seed_tts_voice_clone.csv Seed-TTS-Eval, cloning each prompt (WER, RTFx, SIM x2, UTMOS)+ cv3.csv CV3-Eval, model's own/default voice (WER, RTFx, UTMOS + averages)+ cv3_voice_clone.csv CV3-Eval, cloning each prompt (WER, RTFx, SIM, UTMOS + averages)streaming.csv time-to-first-audio, CPU and GPU (TTFA, RTFx at batch 1)Nothing is pushed unless --open_pr is passed: the default is a dry run that prints the rows.@@ -55,7 +55,7 @@ sys.path.insert(0, REPO_ROOT) # so `from normalizer import ...` resolves regardfrom huggingface_hub import CommitOperationAdd, HfApi, hf_hub_download # noqa: E402-from normalizer.eval_utils import SIM_BACKEND_SUFFIXES, default_multilingual, score_results # noqa: E402+from normalizer.eval_utils import SIM_BACKEND_SUFFIXES, UTMOS_COLUMN_LANGUAGES, default_multilingual, score_results # noqa: E402# Where the results live, and where they are published.RESULTS_BUCKET = "hf-audio/tts_leaderboard_h200"@@ -126,7 +126,7 @@ STREAMING_SIZE_COLUMN = "Size (B)"# ── Bucket ───────────────────────────────────────────────────────────────────-def sync_bucket(bucket, model_folder, local_dir, hf_token=None, clean=False):+def sync_bucket(bucket, model_folder, local_dir, hf_token=None, clean=False, include=None):"""Sync one model's folder out of the bucket, manifests only (scoring never reads the wavs).Same call `_wait_and_score` in scripts/tts_jobs_common.sh makes, so either's folder is usable.@@ -143,7 +143,7 @@ def sync_bucket(bucket, model_folder, local_dir, hf_token=None, clean=False):if hf_token:env["HF_TOKEN"] = hf_tokensubprocess.run(- ["hf", "buckets", "sync", source, dest, "--exclude", "*.wav"],+ ["hf", "buckets", "sync", source, dest, *(["--include", include] if include else ["--exclude", "*.wav"])],check=True,env=env,)@@ -344,6 +344,8 @@ def collect_values(target, header_languages, records, scored, scored_xvector):values[f"{language} RTFx"] = fmt(result["rtfx"])if result.get("sim") is not None:values[f"{language} SIM"] = fmt(result["sim"])+ if result.get("utmos") is not None:+ values[f"{language} UTMOS"] = fmt(result["utmos"])if target.xvector_sim:legacy = scored_xvector.get(dataset_id)if legacy is not None and legacy.get("sim") is not None:@@ -446,6 +448,22 @@ def render(published, index, new_row, sort):return rewrite_sorted(published, index, new_row) if sort else splice_row(published, index, new_row)+def add_utmos_columns(published, languages):+ """Append `<lang> UTMOS` (+ `avg UTMOS` if the file has averages) to a header without them."""+ header = published.header+ if any(column.endswith(" UTMOS") for column in header):+ return published+ header = header + [f"{lang} UTMOS" for lang in languages if lang in UTMOS_COLUMN_LANGUAGES]+ if any(column.startswith("avg ") for column in header):+ header.append("avg UTMOS")+ buffer = io.StringIO(newline="")+ writer = csv.writer(buffer, lineterminator=published.eol or "\n")+ writer.writerow(header)+ for row in published.rows:+ writer.writerow(row + [""] * (len(header) - len(row)))+ return Published(buffer.getvalue())++def header_languages(header):"""Languages the file publishes, read off its own header (every one has a `<lang> WER`)."""return [@@ -489,7 +507,7 @@ def recompute_averages(header, row, languages):"""notes = []index = {column: i for i, column in enumerate(header)}- for metric in ("WER", "RTFx", "SIM"):+ for metric in ("WER", "RTFx", "SIM", "UTMOS"):avg_column = f"avg {metric}"if avg_column not in index:continue@@ -585,6 +603,7 @@ def main():default=None,help="Where to sync results (default: <repo>/results, same place submit_jobs.sh uses).",)+ parser.add_argument("--utmos_bucket", default=None, help="Bucket with the UTMOS sidecars (default: --bucket).")parser.add_argument("--skip_sync", action="store_true", help="Score already-downloaded results.")parser.add_argument("--clean",@@ -649,6 +668,8 @@ def main():file=sys.stderr,)sys.exit(1)+ if args.utmos_bucket:+ sync_bucket(args.utmos_bucket, model_folder, local_dir, args.hf_token, include="UTMOS_*.json")if not os.path.isdir(model_dir):print(f"ERROR: no results directory for {args.model_id}: {model_dir}", file=sys.stderr)sys.exit(1)@@ -732,6 +753,9 @@ def main():if not values:print(f"\n{target.filename}: nothing scored; skipping.")continue+ if any(column.endswith(" UTMOS") for column in values):+ published = add_utmos_columns(published, languages)+ header = published.headeraction, index, new_row = upsert(published, row_name, values, {})notes = recompute_averages(header, new_row, languages)show_row(header, new_row, action, target.filename, notes)diff --git a/scripts/tts_jobs_common.sh b/scripts/tts_jobs_common.shindex 18cf1be..f5594a0 100644--- a/scripts/tts_jobs_common.sh+++ b/scripts/tts_jobs_common.sh@@ -9,10 +9,10 @@# 5. calls run_pipeline## The pipeline for each (model, dataset) is: stage 1 (generate, backend-specific) → stage 2-# (transcribe, shared) → stage 3 (SIM, shared; voice-clone models only) → local scoring. Stages-# run as sequential HF Jobs sharing one bucket; a model's combos run in parallel, models one after-# another. All eval scripts are base64-injected into the jobs at runtime (the Space images only-# carry the environment).+# (transcribe, shared) → stage 3 (SIM, shared; voice-clone models only) → stage 4 (UTMOS, shared)+# → local scoring. Stages run as sequential HF Jobs sharing one bucket; a model's combos run in+# parallel, models one after another. All eval scripts are base64-injected into the jobs at runtime+# (the Space images only carry the environment).## Contract — before calling generate_stage()/transcribe_stage()/sim_stage(), run_pipeline sets:# MODEL_ID MODEL_SAFE MODEL_FOLDER MODEL_CFG (MODEL_CFG = raw config line; parse extras from it)@@ -46,6 +46,7 @@ FLAVOR="${FLAVOR:-h200}"# Stage 2/3 flavors are not timed (WER/SIM are hardware-independent), so a cheaper GPU is fine.ASR_FLAVOR="${ASR_FLAVOR:-l4x1}" # stage 2 flavorSIM_FLAVOR="${SIM_FLAVOR:-l4x1}" # stage 3 flavor+UTMOS_FLAVOR="${UTMOS_FLAVOR:-l4x1}" # stage 4 flavorMAX_EVAL_SAMPLES="${MAX_EVAL_SAMPLES:--1}" # -1 = all; set e.g. 8 to smoke-test# Restrict a run to some of the backend's DATASET_CONFIGS: space-separated asr_language codes# (field 3 of a config line), e.g. ONLY_LANGS="de". Empty (default) runs every configured combo.@@ -65,13 +66,17 @@ SIM_OVERWRITE="${SIM_OVERWRITE:-false}"# Same opt-out for stage 2: transcribe.py skips rows that already have a `pred_text`. Set# ASR_OVERWRITE=true with STAGES="transcribe" to re-transcribe the bucket's existing wavs.ASR_OVERWRITE="${ASR_OVERWRITE:-false}"-MAX_AUDIO_SECONDS="${MAX_AUDIO_SECONDS:-30}" # clip cap for ASR + SIM (0 = no cap)+# Same for stage 4 (forced when `generate` runs).+UTMOS_OVERWRITE="${UTMOS_OVERWRITE:-false}"+# Languages (asr_language) that get stage 4; keep in sync with UTMOS_LANGUAGES in normalizer/eval_utils.py.+UTMOS_LANGS="${UTMOS_LANGS:-en}"+MAX_AUDIO_SECONDS="${MAX_AUDIO_SECONDS:-30}" # clip cap for ASR + SIM + UTMOS (0 = no cap)# Clone each sample's prompt speaker (+ SIM stage) on backends that support it; false = the model's# own fixed/default voice. Ignored by fixed-voice backends.VOICE_CLONE="${VOICE_CLONE:-false}"-# Which stages to run (subset of: generate transcribe sim). Skip generate to re-score the bucket's-# existing wavs, e.g. STAGES="transcribe sim" or STAGES="sim". Precedence (resolved in-# run_pipeline): user env STAGES > backend DEFAULT_STAGES > "generate transcribe sim".+# Which stages to run (subset of: generate transcribe sim utmos). Skip generate to re-score the+# bucket's existing wavs, e.g. STAGES="transcribe sim" or STAGES="sim". Precedence (resolved in+# run_pipeline): user env STAGES > backend DEFAULT_STAGES > "generate transcribe sim utmos".# HF Jobs references a Space image as "hf.co/spaces/<id>" and pulls it. NOTE: the Space must be# PUBLIC (the jobs backend 500s on a private Space image). Images carry only the environment; all@@ -86,6 +91,7 @@ SCORER_IMAGE="hf.co/spaces/${SPACE}"# expose the same columns the backends read: `text` + `prompt_text`/`prompt_audio` when cloning.DATASET_CONFIGS=("tts en en")+utmos_language() { [[ " ${UTMOS_LANGS} " == *" $1 "* ]]; }stage_enabled() { [[ " ${STAGES} " == *" $1 "* ]]; }# ── Injection helpers ────────────────────────────────────────────────────────@@ -125,6 +131,7 @@ inject_run_eval() {# Shared scorer-stage injects (transcribe.py / score_similarity.py live in transformers/).TRANSCRIBE_INJECT="$(inject_cmd "${REPO_ROOT}/transformers/transcribe.py" /app/transformers/transcribe.py)"SIM_INJECT="$(inject_cmd "${REPO_ROOT}/transformers/score_similarity.py" /app/transformers/score_similarity.py)"+UTMOS_INJECT="$(inject_cmd "${REPO_ROOT}/transformers/score_utmos.py" /app/transformers/score_utmos.py)"# ── Default hooks (backends override as needed) ─────────────────────────────# voice_clone_mode [suffix_prefix] — sets CLONE / MODE_SUFFIX / VOICE_CLONE_FLAG from VOICE_CLONE.@@ -191,7 +198,7 @@ run_stage() {done}-# ── Shared stages 2 & 3 (identical for every backend) ───────────────────────+# ── Shared stages 2-4 (identical for every backend) ─────────────────────────transcribe_stage() {local ASR_OVERWRITE_FLAG=""[[ "${ASR_OVERWRITE}" == "true" ]] && ASR_OVERWRITE_FLAG=" --overwrite"@@ -215,6 +222,17 @@ sim_stage() {python /app/transformers/score_similarity.py --manifest_path=${BUCKET_MANIFEST} --sim_backend=${SIM_BACKEND} --batch_size=${SIM_BATCH_SIZE} --max_audio_seconds=${MAX_AUDIO_SECONDS} --device=cuda:0${SIM_OVERWRITE_FLAG}"}+utmos_stage() {+ local UTMOS_OVERWRITE_FLAG=""+ { [[ "${UTMOS_OVERWRITE}" == "true" ]] || stage_enabled generate; } && UTMOS_OVERWRITE_FLAG=" --overwrite"+ hf jobs run \+ --flavor "${UTMOS_FLAVOR}" --timeout 4h --secrets HF_TOKEN ${NAMESPACE_ARG} \+ --volume "hf://buckets/${RESULTS_BUCKET}:/results" "${SCORER_IMAGE}" \+ bash -c "+ ${UTMOS_INJECT}+ python /app/transformers/score_utmos.py --manifest_paths ${BUCKET_MANIFEST} --max_audio_seconds=${MAX_AUDIO_SECONDS} --device=cuda:0${UTMOS_OVERWRITE_FLAG}+ "+}# ── Wait for a model's chains, report failures, then sync + score locally ────# Uses PIDS/TAGS/CHAIN_LOGS set by run_pipeline. Returns non-zero (and skips scoring) on failure.@@ -252,9 +270,12 @@ _wait_and_score() {sync_out=$(timeout "${SYNC_TIMEOUT:-600}" hf buckets sync "hf://buckets/${RESULTS_BUCKET}/${MODEL_FOLDER}" "./results/${MODEL_FOLDER}" --exclude "*.wav" 2>&1) ||echo "WARNING: bucket sync failed (attempt ${attempt}/5):"$'\n'"${sync_out}"missing=()- for name in "${MANIFEST_NAMES[@]}"; do+ for i in "${!MANIFEST_NAMES[@]}"; do+ name="${MANIFEST_NAMES[$i]}"# -s, not -f: an interrupted download leaves a 0-byte file behind.[[ -s "./results/${MODEL_FOLDER}/${name}" ]] || missing+=("${name}")+ stage_enabled utmos && utmos_language "${LANGS[$i]}" && [[ ! -s "./results/${MODEL_FOLDER}/UTMOS_${name%.jsonl}.json" ]] &&+ missing+=("UTMOS_${name%.jsonl}.json")done[[ ${#missing[@]} -eq 0 ]] && breakdone@@ -303,7 +324,7 @@ score_results('$(pwd)/results/${MODEL_FOLDER}', '${MODEL_ID}', language='${lang}# ── The orchestrator ─────────────────────────────────────────────────────────run_pipeline() {- STAGES="${STAGES:-${DEFAULT_STAGES:-generate transcribe sim}}" # user env > backend > global+ STAGES="${STAGES:-${DEFAULT_STAGES:-generate transcribe sim utmos}}" # user env > backend > globalTTS_IMAGE="hf.co/spaces/${TTS_SPACE}"LOG_DIR="${BACKEND_DIR}/job_logs"; mkdir -p "${LOG_DIR}"NAMESPACE_ARG=""; [ -n "$ORG_NAME" ] && NAMESPACE_ARG="--namespace ${ORG_NAME}"@@ -360,6 +381,7 @@ run_pipeline() {stage_enabled generate && run_stage generate_stagestage_enabled transcribe && run_stage transcribe_stagestage_enabled sim && [[ "${CLONE}" == "true" ]] && run_stage sim_stage+ stage_enabled utmos && utmos_language "${ASR_LANG}" && run_stage utmos_stagetrue # ensure subshell exit status is 0 when the last `&&` chain is a skipped stage) > "${CHAIN_LOG}" 2>&1 &PIDS+=("$!"); TAGS+=("${DATASET}/${SPLIT}"); CHAIN_LOGS+=("${CHAIN_LOG}")diff --git a/supertonic/submit_jobs.sh b/supertonic/submit_jobs.shindex 30e9f4c..b44e994 100755--- a/supertonic/submit_jobs.sh+++ b/supertonic/submit_jobs.sh@@ -6,7 +6,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-super}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-super/blob/main/Dockerfile)-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.RUN_EVAL_INJECT="$(inject_run_eval)"diff --git a/transformers/score_utmos.py b/transformers/score_utmos.pynew file mode 100644index 0000000..d4e1a16--- /dev/null+++ b/transformers/score_utmos.py@@ -0,0 +1,88 @@+"""+Predicted MOS (UTMOS) for the Open TTS Leaderboard (stage 4).++Scores each generated wav with UTMOS22 strong (https://github.com/tarepan/SpeechMOS) and writes+`UTMOS_<manifest stem>.json` next to the manifest (or in `--output_dir`). Resumable unless `--overwrite`.+"""++import argparse+import json+import os++import torch+from transformers.audio_utils import load_audio++# v1.2.0, pinned by commit; the checkpoint is pinned by digest.+SPEECHMOS_REPO = "tarepan/SpeechMOS:ed25eacbfa42b99156c36ebec67a733b5dbb9b79"+SPEECHMOS_ENTRY = "utmos22_strong"+CKPT_URL = "https://github.com/tarepan/SpeechMOS/releases/download/v1.0.0/utmos22_strong_step7459_v1.pt"+CKPT_SHA256 = "38aa51ab79e2a4e09a1449758a4b37e9cbb2e8235a49662a732d33a9ba1e9bff"+SAMPLING_RATE = 16_000+MIN_SAMPLES = SAMPLING_RATE // 10 # shorter clips crash the conv front end+++def score_manifest(model, manifest_path, args):+ with open(manifest_path, encoding="utf-8") as f:+ entries = [json.loads(line) for line in f if line.strip()][: args.max_rows if args.max_rows > 0 else None]+ manifest_dir = os.path.dirname(os.path.abspath(manifest_path))+ stem = os.path.splitext(os.path.basename(manifest_path))[0]+ out_path = os.path.join(args.output_dir or manifest_dir, f"UTMOS_{stem}.json")+ os.makedirs(os.path.dirname(out_path), exist_ok=True)++ scores = {}+ if os.path.exists(out_path) and not args.overwrite:+ with open(out_path, encoding="utf-8") as f:+ scores = json.load(f)["scores"]++ def save():+ with open(out_path, "w", encoding="utf-8") as f:+ json.dump({"utmos_model": f"{SPEECHMOS_ENTRY} ({CKPT_SHA256[:12]})", "scores": scores}, f)++ todo = [e["audio_filepath"] for e in entries if e.get("audio_filepath") and e["audio_filepath"] not in scores]+ print(f"{manifest_path}: {len(todo)}/{len(entries)} rows to score -> {out_path}")+ max_samples = int(args.max_audio_seconds * SAMPLING_RATE) if args.max_audio_seconds > 0 else None+ for n, rel in enumerate(todo, 1):+ try:+ speech = load_audio(os.path.join(manifest_dir, rel), sampling_rate=SAMPLING_RATE)[:max_samples]+ except Exception as e: # left unscored, retried on resume+ print(f" WARNING: could not load {rel}: {e}")+ continue+ if len(speech) < MIN_SAMPLES:+ scores[rel] = None+ continue+ with torch.no_grad():+ wav = torch.from_numpy(speech).float().unsqueeze(0).to(args.device)+ scores[rel] = round(model(wav, SAMPLING_RATE).item(), 6)+ if n % args.save_every == 0:+ save()+ save()++ valid = [scores[e["audio_filepath"]] for e in entries if isinstance(scores.get(e.get("audio_filepath")), float)]+ if valid:+ print(f" UTMOS = {sum(valid) / len(valid):.3f} over {len(valid)}/{len(entries)} rows")+++def main(args):+ # skip_validation: the fork check hits the unauthenticated GitHub API, which rate-limits (403)+ # when several jobs start at once; the ref is pinned by commit, so the check adds nothing.+ model = torch.hub.load(SPEECHMOS_REPO, SPEECHMOS_ENTRY, trust_repo=True, pretrained=False, skip_validation=True)+ ckpt = os.path.join(torch.hub.get_dir(), "checkpoints", f"{CKPT_SHA256}.pt")+ if not os.path.exists(ckpt):+ os.makedirs(os.path.dirname(ckpt), exist_ok=True)+ torch.hub.download_url_to_file(CKPT_URL, ckpt, hash_prefix=CKPT_SHA256)+ model.load_state_dict(torch.load(ckpt, map_location="cpu", weights_only=True))+ model = model.to(args.device).eval()+ for manifest_path in args.manifest_paths:+ score_manifest(model, manifest_path, args)+++if __name__ == "__main__":+ parser = argparse.ArgumentParser()+ parser.add_argument("--manifest_paths", type=str, nargs="+", required=True)+ parser.add_argument("--output_dir", type=str, default=None, help="Default: next to each manifest.")+ parser.add_argument("--max_rows", type=int, default=-1)+ parser.add_argument("--overwrite", action="store_true")+ parser.add_argument("--save_every", type=int, default=100)+ parser.add_argument("--max_audio_seconds", type=float, default=30.0)+ parser.add_argument("--device", type=str, default="cuda")+ main(parser.parse_args())diff --git a/vibevoice_realtime/submit_jobs.sh b/vibevoice_realtime/submit_jobs.shindex 7b4f639..f6341dd 100755--- a/vibevoice_realtime/submit_jobs.sh+++ b/vibevoice_realtime/submit_jobs.sh@@ -7,7 +7,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-vibevoice}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-vibevoice/blob/main/Dockerfile)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)RUN_EVAL_INJECT="$(inject_run_eval)"# ── Language → voice preset ──────────────────────────────────────────────────diff --git a/voxtral-tts/submit_jobs.sh b/voxtral-tts/submit_jobs.shindex e44a554..b57cec4 100644--- a/voxtral-tts/submit_jobs.sh+++ b/voxtral-tts/submit_jobs.sh@@ -12,7 +12,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/scripts/tts_jobs_common# ── Backend config ───────────────────────────────────────────────────────────TTS_SPACE="${TTS_SPACE:-bezzam/evals-voxtral}" # stage-1 image (Dockerfile in the Space: https://huggingface.co/spaces/bezzam/evals-voxtral/blob/main/Dockerfile)# gen FLAVOR (h200) is set centrally in tts_jobs_common.sh for RTFx comparability — don't override.-DEFAULT_STAGES="generate transcribe" # no SIM (fixed voice)+DEFAULT_STAGES="generate transcribe utmos" # no SIM (fixed voice)RUN_EVAL_INJECT="$(inject_run_eval)"# ── Stage 1: serve with vLLM-Omni, then run the HTTP client. MODEL_CFG = "model_id batch_size". ──