YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
eval(audio): score whisper-tiny, large-v3-turbo-quantized, and parakeet
Louis Beaumont6636d504ee0a
diff --git a/.github/workflows/eval-diarization.yml b/.github/workflows/eval-diarization.ymlindex 66342f1d4..e729a6032 100644--- a/.github/workflows/eval-diarization.yml+++ b/.github/workflows/eval-diarization.yml@@ -11,9 +11,11 @@# re-appearing across gaps). The composed templates are what test# "screenpipe-shaped" data — the real workload that broke #3107.#-# 2. Transcription quality eval. Runs whisper-tiny on a sample of LibriSpeech+# 2. Transcription quality eval. Runs a small matrix (whisper-tiny,+# whisper-large-v3-turbo-quantized, parakeet) on a sample of LibriSpeech# test-clean and reports WER + CER vs verbatim ground-truth transcripts.-# Catches model/regression-style hits that diarization metrics miss.+# Per-model utterance caps keep total wall under the eval budget — the+# cheap tiny gets 50, the heavier turbo gets 20.## Threshold-tuning PRs WILL show non-zero deltas in the diarization rows.# Lower-is-better:@@ -248,11 +250,11 @@ jobs:cat "/tmp/eval-results/${stem}.json"done- # Score whisper-tiny against LibriSpeech test-clean. 50 utterances- # is enough for a stable mean on most CI runs (~6 min wall) without- # blowing the timeout. The model itself is ~75 MB; download is- # cached by SileroVad's HF helper alongside other screenpipe- # models.+ # Score a small transcription matrix against LibriSpeech test-clean.+ # whisper-tiny gets 50 utterances (~2 min CPU wall); the heavier+ # whisper-large-v3-turbo-quantized gets 20 to keep wall bounded;+ # parakeet (screenpipe's actual local default) gets 50. Model weights+ # are cached by HF — first run downloads, subsequent are warm.- name: Run pipeline replay matrixrun: |/usr/bin/time -v ./target/release/screenpipe-eval-pipeline-replay \@@ -270,20 +272,33 @@ jobs:}jq '.summary' /tmp/eval-results/pipeline-replay.json+ # The binary exits non-zero if any single model failed, but we want+ # the partial report (the rows that did succeed) to still make it+ # into the sticky PR comment. So: capture the exit code, always+ # echo the JSON if it was emitted, and defer the job-failing exit+ # until after the report-posting step.- name: Run transcription eval+ id: transcriptionrun: |+ set +e/usr/bin/time -v ./target/release/screenpipe-eval-transcription \--librispeech-dir crates/screenpipe-audio-eval/evals/fixtures/librispeech/LibriSpeech/test-clean \- --max-utterances 50 \- --whisper-model tiny \+ --models 'tiny=50,whisper-large-v3-turbo-quantized=20,parakeet=50' \> /tmp/eval-results/transcription.json \- 2>/tmp/eval-results/transcription.stderr || {- echo "::error::transcription eval failed"- cat /tmp/eval-results/transcription.stderr- exit 1- }- # Echo the headline numbers so they show up in the run log.- jq '{model, mean_wer, mean_cer, utterance_count, throughput_samples_per_sec}' /tmp/eval-results/transcription.json+ 2>/tmp/eval-results/transcription.stderr+ rc=$?+ echo "exit_code=$rc" >> "$GITHUB_OUTPUT"+ if [ "$rc" -ne 0 ]; then+ echo "::warning::transcription eval exited $rc — partial rows (if any) will still post"+ cat /tmp/eval-results/transcription.stderr+ fi+ # If the binary crashed before writing valid JSON, synthesize a+ # minimal stub so the markdown renderer doesn't blow up.+ if ! jq -e . /tmp/eval-results/transcription.json >/dev/null 2>&1; then+ echo '{"models":[{"model":"all","error":"binary crashed before writing JSON; see step log"}]}' > /tmp/eval-results/transcription.json+ fi+ # Echo headline numbers (or error reasons) so they show up in the run log.+ jq '.models[] | {model, mean_wer, mean_cer, utterance_count, throughput_samples_per_sec, error}' /tmp/eval-results/transcription.json# Compose a sticky PR comment with one row per fixture. We post via# `gh pr comment` rather than a third-party action to keep the deps@@ -382,21 +397,40 @@ jobs:if [ -f /tmp/eval-results/transcription.json ]; thenecho "## Transcription quality"echo- echo "Source: LibriSpeech test-clean (CC-BY-4.0) · whisper-tiny · normalized lowercased word-level Levenshtein"+ echo "Source: LibriSpeech test-clean (CC-BY-4.0) · per-model utterance cap · normalized lowercased word-level Levenshtein"echoecho "| model | utterances | WER | CER | throughput (samples/s) |"echo "|---|---:|---:|---:|---:|"jq -r '- def fmt3: . * 1000 | round / 1000 | tostring;- "| " + (.model // "tiny") +- " | " + (.utterance_count | tostring) +- " | " + (.mean_wer | fmt3) +- " | " + (.mean_cer | fmt3) +- " | " + (.throughput_samples_per_sec | round | tostring) +- " |"+ def fmt3:+ if . == null then "n/a"+ else (. * 1000 | round / 1000 | tostring) end;+ def fmt_int:+ if . == null then "n/a" else tostring end;+ .models[] |+ if .error then+ "| " + (.model // "?") + " | n/a | n/a | n/a | n/a |"+ else+ "| " + (.model // "?") ++ " | " + (.utterance_count | fmt_int) ++ " | " + (.mean_wer | fmt3) ++ " | " + (.mean_cer | fmt3) ++ " | " + (if .throughput_samples_per_sec == null then "n/a" else (.throughput_samples_per_sec | round | tostring) end) ++ " |"+ end' /tmp/eval-results/transcription.json+ # Surface error reasons under the table so failures are visible+ # without digging into the artifact JSON.+ errors=$(jq -r '[.models[] | select(.error)] | length' /tmp/eval-results/transcription.json)+ if [ "$errors" != "0" ]; then+ echo+ echo "Failed models:"+ echo+ jq -r '.models[] | select(.error) | "- `" + (.model // "?") + "`: " + .error' \+ /tmp/eval-results/transcription.json+ fiecho- echo "<sub>WER + CER on read-aloud speech. whisper-tiny is the smallest model and gives a useful regression watch even though larger models score better. See README for normalization rules.</sub>"+ echo "<sub>WER + CER on read-aloud speech. Per-model utterance caps keep wall time bounded — tiny/parakeet at 50, the heavier large-v3-turbo-quantized at 20. See README for normalization rules.</sub>"fi} > /tmp/eval-report.mdcat /tmp/eval-report.md@@ -424,3 +458,11 @@ jobs:gh api -X DELETE "repos/${{ github.repository }}/issues/comments/${id}" || truedonegh pr comment "$PR_NUMBER" --body-file /tmp/eval-report.md++ # Fail the job *after* the report has uploaded + posted, so a failing+ # parakeet/turbo doesn't suppress the rows that did succeed.+ - name: Fail job on transcription error+ if: always() && steps.transcription.outputs.exit_code != '0'+ run: |+ echo "::error::transcription eval exited ${{ steps.transcription.outputs.exit_code }} — see comment table for which model(s) failed"+ exit 1diff --git a/Cargo.lock b/Cargo.lockindex cdc0afc4e..621572555 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -7813,6 +7813,7 @@ name = "screenpipe-audio-eval"version = "0.3.338"dependencies = ["anyhow",+ "audiopipe","chrono","clap","hound",diff --git a/crates/screenpipe-audio-eval/Cargo.toml b/crates/screenpipe-audio-eval/Cargo.tomlindex bc49a5594..137bffbdb 100644--- a/crates/screenpipe-audio-eval/Cargo.toml+++ b/crates/screenpipe-audio-eval/Cargo.toml@@ -30,9 +30,21 @@ chrono = { version = "0.4.31", features = ["serde"] }# Yes this drags in the audio crate's full dep tree (cpal, ort, whisper,# etc.) — that's intentional. The eval is a binary-only consumer; nothing# in the prod tree depends on this crate.-screenpipe-audio = { path = "../screenpipe-audio" }+# `parakeet` here flips on `dep:audiopipe` in screenpipe-audio so the+# transcription eval can construct AudioTranscriptionEngine::Parakeet and+# get a real session (otherwise engine.rs errors out at runtime with+# "neither 'parakeet' nor 'parakeet-mlx' feature is enabled"). The audio+# crate's `parakeet-mlx` is intentionally off here — the eval runs on+# Ubuntu CPU CI, no Metal available.+screenpipe-audio = { path = "../screenpipe-audio", features = ["parakeet"] }screenpipe-core = { path = "../screenpipe-core" }screenpipe-db = { path = "../screenpipe-db" }+# Direct audiopipe dep so the transcription eval can synchronously+# prime Parakeet weights via `Model::from_pretrained` before constructing+# the engine. Without this, `TranscriptionEngine::new` returns+# `Disabled` while audiopipe's background download thread runs and the+# eval silently emits empty hypotheses.+audiopipe = { git = "https://github.com/divanshu-go/audiopipe.git", branch = "main", default-features = false, features = ["parakeet"] }[dev-dependencies]tempfile = "3.3.0"diff --git a/crates/screenpipe-audio-eval/src/bin/eval_transcription.rs b/crates/screenpipe-audio-eval/src/bin/eval_transcription.rsindex bc02c4d98..6a89bfbc3 100644--- a/crates/screenpipe-audio-eval/src/bin/eval_transcription.rs+++ b/crates/screenpipe-audio-eval/src/bin/eval_transcription.rs@@ -12,11 +12,16 @@//! `TranscriptionSession` (no VAD, no segmentation — utterances are short),//! and score the resulting hypothesis with WER/CER + throughput.//!+//! Multiple engines per invocation. The CLI accepts a comma-separated list of+//! `name[=cap]` entries via `--models`; each entry is scored independently and+//! emitted as its own row. Per-model caps let us run the cheap whisper-tiny on+//! a healthy sample while keeping large-v3-turbo bounded under the CI budget.+//!//! ## Output//!-//! JSON to stdout with headline metrics at the top level and a `utterances`-//! array carrying per-utterance details for the artifact. Stderr gets-//! human-readable progress logs.+//! JSON to stdout. Top-level `models` array; each element has the headline+//! WER/CER/throughput metrics + a `utterances` array for the artifact. Stderr+//! gets human-readable progress logs.use anyhow::{Context, Result};use clap::Parser;@@ -25,28 +30,32 @@ use screenpipe_audio::transcription::engine::TranscriptionEngine;use screenpipe_audio::transcription::whisper::model::{download_whisper_model, get_cached_whisper_model_path,};-use screenpipe_audio_eval::{load_utterances, score_transcription};+use screenpipe_audio_eval::{load_utterances, score_transcription, LibriUtterance};use serde::Serialize;use std::path::PathBuf;use std::sync::Arc;use std::time::Instant;#[derive(Parser, Debug)]-#[command(about = "Score whisper transcription against LibriSpeech ground truth")]+#[command(about = "Score local transcription engines against LibriSpeech ground truth")]struct Args {/// Path to LibriSpeech/test-clean/ (the dir that contains <speaker>/<chapter>/...).#[arg(long)]librispeech_dir: PathBuf,- /// Cap the number of utterances scored. Full test-clean is 2620 utterances;- /// 50 is enough for a CI signal at a fraction of the wall time.+ /// Fallback cap when a `--models` entry omits `=N`. Full test-clean is 2620+ /// utterances; 50 is enough for a stable WER mean at a fraction of the+ /// wall time.#[arg(long, default_value_t = 50)]max_utterances: usize,- /// Whisper model variant. tiny is the CI default — its quality is poor but- /// it builds the infrastructure to swap in larger models locally.+ /// Comma-separated list of `name[=cap]` entries. Names: `tiny`,+ /// `tiny-quantized`, `whisper-large-v3-turbo`, `whisper-large-v3-turbo-quantized`,+ /// `whisper-large` (large-v3), `whisper-large-quantized`, `parakeet`. When+ /// `=cap` is omitted, falls back to `--max-utterances`. Each model is run in+ /// listed order and emitted as its own JSON row.#[arg(long, default_value = "tiny")]- whisper_model: String,+ models: String,}#[derive(Debug, Serialize)]@@ -61,69 +70,241 @@ struct UtteranceResult {duration_seconds: f32,}-fn parse_whisper_model(s: &str) -> Result<AudioTranscriptionEngine> {- match s {- "tiny" => Ok(AudioTranscriptionEngine::WhisperTiny),- "tiny-quantized" => Ok(AudioTranscriptionEngine::WhisperTinyQuantized),- // "base" is not a separate variant in screenpipe — fall through to tiny.- // Surface a clear error rather than silently substitute.- "base" => anyhow::bail!(- "whisper-base is not a screenpipe engine variant; use 'tiny' or 'small' (large)"+fn parse_engine(name: &str) -> Result<AudioTranscriptionEngine> {+ match name {+ "tiny" | "whisper-tiny" => Ok(AudioTranscriptionEngine::WhisperTiny),+ "tiny-quantized" | "whisper-tiny-quantized" => {+ Ok(AudioTranscriptionEngine::WhisperTinyQuantized)+ }+ "whisper-large" | "whisper-large-v3" => Ok(AudioTranscriptionEngine::WhisperLargeV3),+ "whisper-large-quantized" | "whisper-large-v3-quantized" => {+ Ok(AudioTranscriptionEngine::WhisperLargeV3Quantized)+ }+ "whisper-large-v3-turbo" => Ok(AudioTranscriptionEngine::WhisperLargeV3Turbo),+ "whisper-large-v3-turbo-quantized" => {+ Ok(AudioTranscriptionEngine::WhisperLargeV3TurboQuantized)+ }+ "parakeet" => Ok(AudioTranscriptionEngine::Parakeet),+ // `base` is not a screenpipe engine variant; surface clearly rather+ // than silently substituting tiny.+ "base" | "whisper-base" => anyhow::bail!(+ "whisper-base is not a screenpipe engine variant; use tiny / whisper-large-v3 / whisper-large-v3-turbo / parakeet"),- "small" | "large" => Ok(AudioTranscriptionEngine::WhisperLargeV3),- "medium" => Ok(AudioTranscriptionEngine::WhisperLargeV3Quantized),- other => anyhow::bail!("unknown whisper model: {other}"),+ other => anyhow::bail!("unknown model: {other}"),}}-#[tokio::main(flavor = "multi_thread", worker_threads = 2)]-async fn main() -> Result<()> {- let args = Args::parse();+#[derive(Debug)]+struct ModelSpec {+ /// Original token from the CLI — used as the JSON `model` field so the+ /// markdown report shows what the user asked for, not the internal enum.+ name: String,+ engine: AudioTranscriptionEngine,+ cap: usize,+}- eprintln!("loading librispeech: {}", args.librispeech_dir.display());- let mut utterances = load_utterances(&args.librispeech_dir).context("load utterances")?;- let total = utterances.len();- if args.max_utterances < total {- utterances.truncate(args.max_utterances);+fn parse_models(spec: &str, default_cap: usize) -> Result<Vec<ModelSpec>> {+ let mut out = Vec::new();+ for entry in spec.split(',') {+ let entry = entry.trim();+ if entry.is_empty() {+ continue;+ }+ let (name, cap) = match entry.split_once('=') {+ Some((n, c)) => {+ let parsed: usize = c+ .trim()+ .parse()+ .with_context(|| format!("invalid cap for {n}: {c}"))?;+ (n.trim().to_string(), parsed)+ }+ None => (entry.to_string(), default_cap),+ };+ if cap == 0 {+ anyhow::bail!("cap for {name} is 0; pass a positive integer or omit `=N`");+ }+ let engine = parse_engine(&name)?;+ out.push(ModelSpec { name, engine, cap });}- eprintln!(- "loaded {} utterances (capped from {} via --max-utterances)",- utterances.len(),- total- );+ if out.is_empty() {+ anyhow::bail!("--models is empty after parsing: {spec:?}");+ }+ Ok(out)+}- let engine_variant = Arc::new(parse_whisper_model(&args.whisper_model)?);- eprintln!("ensuring whisper model on disk: {:?}", engine_variant);+#[cfg(test)]+mod tests {+ use super::*;- // The TranscriptionEngine constructor returns Self::Disabled if the model- // isn't cached and kicks off a background download. We don't want a- // disabled session, so download synchronously up front.- if get_cached_whisper_model_path(&engine_variant).is_none() {- let variant_for_download = engine_variant.clone();- tokio::task::spawn_blocking(move || download_whisper_model(variant_for_download))- .await- .map_err(|e| anyhow::anyhow!("whisper download task panicked: {}", e))?- .context("download whisper model")?;+ #[test]+ fn single_model_no_cap_uses_default() {+ let specs = parse_models("tiny", 50).unwrap();+ assert_eq!(specs.len(), 1);+ assert_eq!(specs[0].name, "tiny");+ assert_eq!(specs[0].cap, 50);+ assert!(matches!(specs[0].engine, AudioTranscriptionEngine::WhisperTiny));}- eprintln!("whisper model ready");- let engine =- TranscriptionEngine::new(engine_variant.clone(), None, None, Vec::new(), Vec::new())- .await- .context("construct TranscriptionEngine")?;+ #[test]+ fn cap_override_wins_over_default() {+ let specs = parse_models("tiny=10", 50).unwrap();+ assert_eq!(specs[0].cap, 10);+ }++ #[test]+ fn multiple_models_preserve_order() {+ let specs =+ parse_models("tiny=50,whisper-large-v3-turbo-quantized=20,parakeet", 30).unwrap();+ assert_eq!(specs.len(), 3);+ assert_eq!(specs[0].name, "tiny");+ assert_eq!(specs[0].cap, 50);+ assert_eq!(specs[1].name, "whisper-large-v3-turbo-quantized");+ assert_eq!(specs[1].cap, 20);+ assert_eq!(specs[2].name, "parakeet");+ // parakeet falls back to default since no =N was provided.+ assert_eq!(specs[2].cap, 30);+ }++ #[test]+ fn whitespace_and_empty_entries_tolerated() {+ let specs = parse_models(" tiny ,, , parakeet=5 ", 50).unwrap();+ assert_eq!(specs.len(), 2);+ assert_eq!(specs[0].name, "tiny");+ assert_eq!(specs[1].name, "parakeet");+ assert_eq!(specs[1].cap, 5);+ }++ #[test]+ fn unknown_model_errors_with_clear_message() {+ let err = parse_models("bogus-engine", 50).unwrap_err().to_string();+ assert!(+ err.contains("unknown model"),+ "expected 'unknown model' in: {err}"+ );+ }++ #[test]+ fn base_alias_rejected_not_silently_remapped() {+ let err = parse_models("base", 50).unwrap_err().to_string();+ // Don't silently fall through to tiny — surface a clear error so the+ // CI report doesn't mislead.+ assert!(+ err.contains("not a screenpipe engine variant"),+ "expected explicit rejection in: {err}"+ );+ }++ #[test]+ fn empty_spec_errors() {+ let err = parse_models("", 50).unwrap_err().to_string();+ assert!(err.contains("empty"), "expected 'empty' in: {err}");+ let err2 = parse_models(" , , ", 50).unwrap_err().to_string();+ assert!(err2.contains("empty"), "expected 'empty' in: {err2}");+ }++ #[test]+ fn zero_cap_rejected() {+ let err = parse_models("tiny=0", 50).unwrap_err().to_string();+ assert!(err.contains("is 0"), "expected '=0' rejection in: {err}");+ }++ #[test]+ fn non_numeric_cap_errors() {+ let err = parse_models("tiny=lots", 50).unwrap_err().to_string();+ assert!(err.contains("invalid cap"), "expected parse error in: {err}");+ }++ #[test]+ fn whisper_aliases_resolve() {+ assert!(matches!(+ parse_engine("whisper-tiny").unwrap(),+ AudioTranscriptionEngine::WhisperTiny+ ));+ assert!(matches!(+ parse_engine("whisper-large").unwrap(),+ AudioTranscriptionEngine::WhisperLargeV3+ ));+ assert!(matches!(+ parse_engine("whisper-large-v3-turbo-quantized").unwrap(),+ AudioTranscriptionEngine::WhisperLargeV3TurboQuantized+ ));+ assert!(matches!(+ parse_engine("parakeet").unwrap(),+ AudioTranscriptionEngine::Parakeet+ ));+ }+}++/// Ensure the model weights are on disk before constructing the engine.+/// Whisper variants go through screenpipe's own HF helper; Parakeet goes+/// through audiopipe directly because the engine constructor only does a+/// cache-only check and spawns a background download otherwise.+async fn prime_model(engine: &AudioTranscriptionEngine) -> Result<()> {+ match engine {+ AudioTranscriptionEngine::Parakeet => {+ // Match the CPU model name used at engine.rs (parakeet-mlx is not+ // available on Linux CI anyway).+ const MODEL_NAME: &str = "parakeet-tdt-0.6b-v3";+ if audiopipe::Model::from_pretrained_cache_only(MODEL_NAME).is_ok() {+ return Ok(());+ }+ eprintln!("downloading parakeet weights: {MODEL_NAME}");+ tokio::task::spawn_blocking(|| audiopipe::Model::from_pretrained(MODEL_NAME))+ .await+ .map_err(|e| anyhow::anyhow!("parakeet download task panicked: {e}"))?+ .map_err(|e| anyhow::anyhow!("parakeet download failed: {e}"))?;+ Ok(())+ }+ _ => {+ let arc = Arc::new(engine.clone());+ if get_cached_whisper_model_path(&arc).is_some() {+ return Ok(());+ }+ let arc_for_download = arc.clone();+ tokio::task::spawn_blocking(move || download_whisper_model(arc_for_download))+ .await+ .map_err(|e| anyhow::anyhow!("whisper download task panicked: {e}"))?+ .context("download whisper model")?;+ Ok(())+ }+ }+}++async fn run_model(+ spec: &ModelSpec,+ utterances: &[LibriUtterance],+) -> Result<(serde_json::Value, Vec<UtteranceResult>)> {+ eprintln!(+ "==> model {} ({:?}) cap={} utterances",+ spec.name, spec.engine, spec.cap+ );+ prime_model(&spec.engine).await?;++ let engine = TranscriptionEngine::new(+ Arc::new(spec.engine.clone()),+ None,+ None,+ Vec::new(),+ Vec::new(),+ )+ .await+ .with_context(|| format!("construct TranscriptionEngine for {}", spec.name))?;if matches!(engine, TranscriptionEngine::Disabled) {- anyhow::bail!("TranscriptionEngine resolved to Disabled — model still missing?");+ anyhow::bail!("TranscriptionEngine resolved to Disabled for {}", spec.name);}- let mut session = engine.create_session().context("create_session")?;+ let mut session = engine+ .create_session()+ .with_context(|| format!("create_session for {}", spec.name))?;- let mut scored: Vec<(String, String)> = Vec::with_capacity(utterances.len());- let mut details: Vec<UtteranceResult> = Vec::with_capacity(utterances.len());+ let take = spec.cap.min(utterances.len());+ let mut scored: Vec<(String, String)> = Vec::with_capacity(take);+ let mut details: Vec<UtteranceResult> = Vec::with_capacity(take);let mut total_audio_seconds = 0.0f32;let started = Instant::now();- for (idx, utt) in utterances.iter().enumerate() {+ for (idx, utt) in utterances.iter().take(take).enumerate() {let (samples, source_rate) = screenpipe_audio::pcm_decode(&utt.flac_path).with_context(|| format!("pcm_decode {}", utt.flac_path.display()))?;let samples_16k = if source_rate != 16_000 {@@ -137,14 +318,15 @@ async fn main() -> Result<()> {let hyp = session.transcribe(&samples_16k, 16_000, "eval").await- .with_context(|| format!("transcribe {}", utt.id))?;+ .with_context(|| format!("transcribe {} ({})", utt.id, spec.name))?;let wer = screenpipe_audio_eval::word_error_rate(&utt.reference_transcript, &hyp);let cer = screenpipe_audio_eval::char_error_rate(&utt.reference_transcript, &hyp);eprintln!(- "[{}/{}] {} ({:.2}s) wer={:.3} cer={:.3}",+ "[{}][{}/{}] {} ({:.2}s) wer={:.3} cer={:.3}",+ spec.name,idx + 1,- utterances.len(),+ take,utt.id,duration_s,wer,@@ -171,7 +353,7 @@ async fn main() -> Result<()> {if let Some(obj) = json.as_object_mut() {obj.insert("model".into(),- serde_json::Value::String(args.whisper_model.clone()),+ serde_json::Value::String(spec.name.clone()),);obj.insert("wall_clock_seconds".into(),@@ -181,8 +363,59 @@ async fn main() -> Result<()> {"total_audio_seconds".into(),serde_json::Value::from(total_audio_seconds),);- obj.insert("utterances".into(), serde_json::to_value(&details)?);}- println!("{}", serde_json::to_string(&json)?);+ Ok((json, details))+}++#[tokio::main(flavor = "multi_thread", worker_threads = 2)]+async fn main() -> Result<()> {+ let args = Args::parse();+ let specs = parse_models(&args.models, args.max_utterances)?;+ let max_cap = specs.iter().map(|s| s.cap).max().unwrap_or(args.max_utterances);++ eprintln!("loading librispeech: {}", args.librispeech_dir.display());+ let mut utterances = load_utterances(&args.librispeech_dir).context("load utterances")?;+ let total = utterances.len();+ if max_cap < total {+ utterances.truncate(max_cap);+ }+ eprintln!(+ "loaded {} utterances (capped from {} via max model cap)",+ utterances.len(),+ total+ );++ // Per-model error isolation: a failing model (cold parakeet download,+ // whisper variant pulled and missing, etc.) shouldn't kill the whole+ // report. Each failure becomes its own JSON row with `error`. The+ // process still exits non-zero at the end so CI flags it — but only+ // after the markdown report has a chance to render the rows that did+ // succeed.+ let mut model_rows: Vec<serde_json::Value> = Vec::with_capacity(specs.len());+ let mut had_failure = false;+ for spec in &specs {+ match run_model(spec, &utterances).await {+ Ok((mut row, details)) => {+ if let Some(obj) = row.as_object_mut() {+ obj.insert("utterances".into(), serde_json::to_value(&details)?);+ }+ model_rows.push(row);+ }+ Err(err) => {+ had_failure = true;+ eprintln!("::error::model {} failed: {err:#}", spec.name);+ model_rows.push(serde_json::json!({+ "model": spec.name,+ "error": format!("{err:#}"),+ }));+ }+ }+ }++ let out = serde_json::json!({ "models": model_rows });+ println!("{}", serde_json::to_string(&out)?);+ if had_failure {+ anyhow::bail!("one or more models failed; see error rows in the JSON output");+ }Ok(())}