Spaces:
Running on Zero
Running on Zero
Remove Nemotron 3.5 Transcribe (cannot run on ZeroGPU); donations use consensus audit
Browse filesFiles changed (3)
- README.md+55-86
- app.py+33-244
- requirements.txt-1
13 unmodified lines141516171819202 unmodified lines232425262728291 unmodified line313233343536373839402 unmodified lines434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293943 unmodified lines989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914013 unmodified linesmodels:- primeline/parakeet-primeline- moondream/parakeet-ultra- nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-NVFP4- nvidia/Nemotron-3-Diarizationdatasets:- flozi00/parakeet-donated-snippets2 unmodified lines# Parakeet Model ComparisonSide-by-side comparison of current open speech recognition models, with speakerdiarization, reference-transcript scoring and judge-audited dataset donations.## Models1 unmodified line| --- | --- | --- || π’ **Parakeet Primeline** (`flozi00/parakeet-primeline`) | in-Space (NeMo) | our fine-tuned German Parakeet TDT || π΅ **Parakeet Ultra** (`moondream/parakeet-ultra`) | in-Space (Photon) | post-trained `parakeet-tdt-0.6b-v3`, 25 languages, CC-BY-4.0 || π£ **Nemotron 3.5 Transcribe 30B A4B NVFP4** (`nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-NVFP4`) | remote OpenAI-compatible endpoint | 34B MoE (4.3B active), 40 languages, 64k context || π£οΈ **Nemotron 3 Diarization** (`nvidia/Nemotron-3-Diarization`) | in-Space (NeMo) | up to 8 speakers, openmdw-1.1 |The Whisper models that used to be part of this demo have been removed.## Features2 unmodified lines- **Reference transcript** (optional): paste the correct text and get **WER** and**CER** per model plus word-level diffs against your reference.- Click a segment to play it; download Primeline output as CSV/SRT.- **Donate a segment**: the Nemotron judge listens to the audio, compares everycandidate transcript (all models plus your reference) and stores the best one.Wrong or malicious donations are rejected, so the dataset keeps its quality.## Why Nemotron runs remotelyThe NVFP4 checkpoint needs a Blackwell GPU and vLLM 0.32 with the`nemo_speechlm` plugin. vLLM cannot run inside a ZeroGPU Space (ZeroGPU forks ashort-lived GPU worker per request, which is incompatible with vLLM's memorymanagement), so the Space talks to an OpenAI-compatible endpoint instead.Configure it with Space secrets:| Secret | Example || --- | --- || `NEMOTRON_BASE_URL` | `https://your-host/v1` || `NEMOTRON_API_KEY` | `sk-β¦` (use `EMPTY` for an unauthenticated vLLM) || `NEMOTRON_MODEL` (optional) | defaults to `nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-NVFP4` |Serve it with:```bashexport VLLM_PLUGINS=nemo_speechlmexport VLLM_MAX_AUDIO_DECODE_DURATION_S=3600export VLLM_MAX_AUDIO_CLIP_FILESIZE_MB=180vllm serve nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-NVFP4 \--served-model-name nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-NVFP4 \--trust-remote-code --dtype bfloat16 --kv-cache-dtype fp8 \--gpu-memory-utilization 0.85 --max-model-len 65536 \--max-num-batched-tokens 4096 --max-num-seqs 64 \--enable-chunked-prefill --no-enable-prefix-caching \--use-replayssm --mamba-backend flashinfer --mamba-cache-mode none \--mm-processor-cache-gb 0 --no-async-scheduling \--limit-mm-per-prompt '{"audio":{"count":1,"length":57600000}}' \--speculative-config '{"method":"mtp","num_speculative_tokens":8}'```Without the secrets the Space still works: the Nemotron column reports"endpoint not configured" and donations fall back to a consensus pick that ismarked `verified_against_audio: false`.## Donation datasetDonated snippets land in `flozi00/parakeet-donated-snippets` (batched every10 minutes). Each record stores the audio, the winning transcript, the judgeverdict, every candidate transcript and the WER/CER against the user reference.## Runtime notes3 unmodified linesfree visitors at 60 s per task, so the GPU function requests 40 s. Models arepreloaded on CPU at startup and stay resident on the GPU afterwards β movingNeMo models back to CPU between calls crashes the CUDA context.- The Space GPU is an `RTX PRO 6000 Blackwell Server Edition MIG 2g.48gb`(50.9 GB VRAM, sm_120), so the quantized checkpoints fit. Nemotron 3.5Transcribe still cannot run here, and the reason is not the hardware:- NeMo cannot load it: `ASRModel.from_pretrained` fails with`FileNotFoundError: .../model_config.yaml` (the repos are HF/vLLM format).- transformers can: with `python_version: "3.12"` and `transformers==5.22.2`the `Nemotron3_5TranscribeProcessor` loads and`AutoModelForMultimodalLM.from_pretrained(...)` succeeds for BF16, FP8 andNVFP4 β `Nemotron3_5TranscribeForConditionalGeneration`, 32.36 B params.- **The quantized checkpoints do not save VRAM under transformers**, and thereason is structural, not a config mistake:- The NVFP4 repo declares `quant_method: "modelopt"`. transformers 5.22.2registers `compressed-tensors`, `nvfp4`, `fp8`, `bitsandbytes`, `gptq`,`awq` β but **no `modelopt` quantizer**, so the config is ignored and theweights load as bf16: 21.6 GB on disk, **66.2 GB in memory**.- transformers' own `NVFP4Config` (on-the-fly quantization) cannot helpeither: `_is_nvfp4_compatible` requires `isinstance(module, nn.Linear)`,and this model keeps its experts in `NemotronHExperts` as raw 3D`nn.Parameter`s (`up_proj`, `down_proj`) driven by `grouped_mm`.- Those experts are **30.65 B of the 32.36 B parameters (94.7 %)**:128 experts x 1856 x 2688 x 2 projections x 24 MoE layers. In bf16 that is**61.3 GB** β the part that has to shrink, and the part transformerscannot quantize. NVFP4 would bring it to 15.3 GB (18.7 GB total, whichwould fit), but no transformers code path produces that.- So both routes end in the same OOM: pre-quantized loads dequantize to66.2 GB, on-the-fly quantizes only the 1.71 B non-expert parameters andleaves 61.3 GB of experts in bf16. `model.to("cuda")` reports it as`NVML_SUCCESS == r INTERNAL ASSERT FAILED` β that assert sits in theallocator's OOM handler (`CUDACachingAllocator.cpp:1407`,`nvmlDeviceGetComputeRunningProcesses`), so it masks a plain CUDA OOM.- CPU offload does not rescue it either: `infer_auto_device_map` +`dispatch_model` splits the model across 66 shards, but generation thendies in `grouped_mm_experts_forward` β the MoE kernel needs every experton one device, and the experts alone exceed VRAM.- The load also takes **214-262 s on CPU** (measured), far beyond the 60 s afree visitor gets.- The only runtime that keeps these checkpoints quantized is vLLM 0.32 +the `nemo_speechlm` plugin (ModelOpt + fused NVFP4 MoE kernels) on apersistent GPU process. Hence the remote endpoint.13 unmodified lines1415161718192 unmodified lines222324252627281 unmodified line303132333435363738392 unmodified lines424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021033 unmodified lines10710810913 unmodified linesmodels:- primeline/parakeet-primeline- moondream/parakeet-ultra- nvidia/Nemotron-3-Diarizationdatasets:- flozi00/parakeet-donated-snippets2 unmodified lines# Parakeet Model ComparisonSide-by-side comparison of current open speech recognition models, with speakerdiarization, reference-transcript scoring and audited dataset donations.## Models1 unmodified line| --- | --- | --- || π’ **Parakeet Primeline** (`flozi00/parakeet-primeline`) | in-Space (NeMo) | our fine-tuned German Parakeet TDT || π΅ **Parakeet Ultra** (`moondream/parakeet-ultra`) | in-Space (Photon) | post-trained `parakeet-tdt-0.6b-v3`, 25 languages, CC-BY-4.0 || π£οΈ **Nemotron 3 Diarization** (`nvidia/Nemotron-3-Diarization`) | in-Space (NeMo) | up to 8 speakers, openmdw-1.1 |The Whisper models that used to be part of this demo have been removed, and sohas Nemotron 3.5 Transcribe (see below).## Features2 unmodified lines- **Reference transcript** (optional): paste the correct text and get **WER** and**CER** per model plus word-level diffs against your reference.- Click a segment to play it; download Primeline output as CSV/SRT.- **Donate a segment**: every candidate transcript (all models plus yourreference) is cross-checked and the consensus one is stored. Wrong ormalicious donations are rejected, so the dataset keeps its quality.## Why Nemotron 3.5 Transcribe is not part of this SpaceIt was removed after measuring that it cannot run on this hardware with anysupported runtime. The Space GPU is an `RTX PRO 6000 Blackwell Server EditionMIG 2g.48gb` (50.9 GB VRAM, sm_120), and the model needs more than that in everyconfiguration transformers offers:- NeMo cannot load it: `ASRModel.from_pretrained` fails with`FileNotFoundError: .../model_config.yaml` (the repos are HF/vLLM format).- transformers can load it β with `python_version: "3.12"` and`transformers==5.22.2` the `Nemotron3_5TranscribeProcessor` works and`AutoModelForMultimodalLM.from_pretrained(...)` returns`Nemotron3_5TranscribeForConditionalGeneration`, 32.36 B params β but thequantized checkpoints do not save VRAM, and the reason is structural:- The NVFP4 repo declares `quant_method: "modelopt"`. transformers 5.22.2registers `compressed-tensors`, `nvfp4`, `fp8`, `bitsandbytes`, `gptq`,`awq` β but **no `modelopt` quantizer**, so the config is ignored and theweights load as bf16: 21.6 GB on disk, **66.2 GB in memory**.- transformers' own `NVFP4Config` (on-the-fly quantization) cannot helpeither: `_is_nvfp4_compatible` requires `isinstance(module, nn.Linear)`,and this model keeps its experts in `NemotronHExperts` as raw 3D`nn.Parameter`s (`up_proj`, `down_proj`) driven by `grouped_mm`.- Those experts are **30.65 B of the 32.36 B parameters (94.7 %)**: 128experts x 1856 x 2688 x 2 projections x 24 MoE layers. In bf16 that is**61.3 GB** β the part that has to shrink, and the part transformers cannotquantize. NVFP4 would bring it to 15.3 GB (18.7 GB total, which would fit),but no transformers code path produces that.- So both routes end in the same OOM: pre-quantized loads dequantize to66.2 GB, on-the-fly quantizes only the 1.71 B non-expert parameters andleaves 61.3 GB of experts in bf16. `model.to("cuda")` reports it as`NVML_SUCCESS == r INTERNAL ASSERT FAILED` β that assert sits in theallocator's OOM handler (`CUDACachingAllocator.cpp:1407`,`nvmlDeviceGetComputeRunningProcesses`), so it masks a plain CUDA OOM.- CPU offload does not rescue it either: `infer_auto_device_map` +`dispatch_model` splits the model across 66 shards, but generation then diesin `grouped_mm_experts_forward` β the MoE kernel needs every expert on onedevice, and the experts alone exceed VRAM.- The load also takes **214-262 s on CPU** (measured), far beyond the 60 s afree visitor gets.The only runtime that keeps these checkpoints quantized is vLLM 0.32 + the`nemo_speechlm` plugin (ModelOpt + fused NVFP4 MoE kernels) on a persistent GPUprocess, which ZeroGPU cannot host. To bring the model back, serve it there andre-add the column against that endpoint.## Donation datasetDonated snippets land in `flozi00/parakeet-donated-snippets` (batched every10 minutes). Each record stores the audio, the winning transcript, everycandidate transcript and the WER/CER against the user reference. Records aremarked `judge: consensus-fallback` and `verified_against_audio: false`, becauseno audio-listening judge is configured.## Runtime notes3 unmodified linesfree visitors at 60 s per task, so the GPU function requests 40 s. Models arepreloaded on CPU at startup and stay resident on the GPU afterwards β movingNeMo models back to CPU between calls crashes the CUDA context.
1234567891011126 unmodified lines1920212223242535 unmodified lines61626364656667686970717273747576777879808182838485868788899091929349 unmodified lines143144145146147148149238 unmodified lines38838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052128 unmodified lines55055155255355455555617 unmodified lines57457557657757857958081 unmodified lines662663664665666667668669670671672673674675676677678679680681682683684122 unmodified lines80780880981081181281381481581681781881982082182265 unmodified lines88888989089189289389489510 unmodified lines90690790890991091191243 unmodified lines95695795895996096196296396496596616 unmodified lines98398498598698798898923 unmodified lines101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610473 unmodified lines1051105210531054105510561057105814 unmodified lines1073107410751076107710781079108010811082108310841085108620 unmodified lines110711081109111011111112111330 unmodified lines1144114511461147114811491150115111521153115411551156115711581159116011611162116311648 unmodified lines1173117411751176117711781179118011819 unmodified lines1191119211931194119511961197119811991200120112025 unmodified lines1208120912101211121212131214121512161217121811 unmodified lines1230123112321233123412351236123712384 unmodified lines1243124412451246124712481249125012511252125312541 unmodified line12561257125812591260126112625 unmodified lines1268126912701271"""Parakeet Model Comparison β Primeline vs Parakeet Ultra vs Nemotron 3.5 Transcribe.Runs on a ZeroGPU Space. Two models run locally (NeMo Parakeet Primeline, PhotonParakeet Ultra), speaker diarization runs locally (Nemotron 3 Diarization), andNemotron 3.5 Transcribe is called through an OpenAI-compatible endpoint becauseits NVFP4 checkpoint needs vLLM + Blackwell, which ZeroGPU cannot host.Optional reference transcript -> WER/CER per model.Donations are audited by the Nemotron judge before they reach the dataset."""import os6 unmodified linesimport spaces # noqa: E402 (must come before torch)import base64 # noqa: E402import csv # noqa: E402import datetime # noqa: E402import difflib # noqa: E40235 unmodified linesprint("Snippet donations will be saved locally only.")donation_scheduler = None# === Nemotron 3.5 Transcribe (remote, OpenAI-compatible) ===# NVFP4 needs Blackwell + vLLM 0.32 with the nemo_speechlm plugin, which cannot# run inside a ZeroGPU Space (vLLM is incompatible with ZeroGPU's forked GPU# worker). Point these at any OpenAI-compatible vLLM/NIM deployment instead.NEMOTRON_BASE_URL = os.environ.get("NEMOTRON_BASE_URL", "").strip().rstrip("/")NEMOTRON_API_KEY = os.environ.get("NEMOTRON_API_KEY", "").strip()NEMOTRON_MODEL = os.environ.get("NEMOTRON_MODEL", "nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-NVFP4").strip()NEMOTRON_ENABLED = bool(NEMOTRON_BASE_URL)_nemotron_client = Nonedef nemotron_client():global _nemotron_clientif _nemotron_client is None:from openai import OpenAI_nemotron_client = OpenAI(base_url=NEMOTRON_BASE_URL,api_key=NEMOTRON_API_KEY or "EMPTY",timeout=900,)return _nemotron_client# === Local models ===device = "cuda" if torch.cuda.is_available() else "cpu"49 unmodified linesMODEL_SPECS = [("primeline", "π’ Parakeet Primeline", "#22c55e"),("parakeet_ultra", "π΅ Parakeet Ultra", "#3b82f6"),("nemotron", "π£ Nemotron 3.5 Transcribe 30B", "#8b5cf6"),]MODEL_LABELS = {key: label for key, label, _ in MODEL_SPECS}238 unmodified linesreturn segmentsNEMOTRON_TRANSCRIBE_PROMPT = ("Transcribe the following audio verbatim in its original language. ""Preserve punctuation, casing, numbers and names. ""Output only the transcript, without any introduction or commentary.")def transcribe_nemotron(transcribe_path):if not NEMOTRON_ENABLED:raise RuntimeError("Nemotron endpoint not configured (set NEMOTRON_BASE_URL / NEMOTRON_API_KEY).")audio_b64 = base64.b64encode(Path(transcribe_path).read_bytes()).decode()response = nemotron_client().chat.completions.create(model=NEMOTRON_MODEL,messages=[{"role": "user","content": [{"type": "text", "text": NEMOTRON_TRANSCRIBE_PROMPT},{"type": "audio_url","audio_url": {"url": f"data:audio/wav;base64,{audio_b64}"},},],}],temperature=0,extra_body={"chat_template_kwargs": {"enable_thinking": False},"skip_special_tokens": False,},)text = (response.choices[0].message.content or "").strip()return [{"start": 0.0, "end": 0.0, "segment": text}]# === Judge ===JUDGE_PROMPT = """You are a strict transcription auditor for a speech dataset.You hear one audio segment and receive candidate transcripts of that segment.Decide which candidate is the most faithful transcript of what is actually said.Rules:- Judge only against the audio. Fluency is not correctness.- A candidate that adds, drops, invents or paraphrases content is wrong.- A candidate in the wrong language is wrong.- If no candidate is fully correct, write the correct transcript yourself andreport best_source as "corrected".- Never trust a candidate just because it is long or detailed.Candidates:{candidates}{reference_block}Return ONLY a JSON object, no markdown:{{"best_source": "<candidate key or 'corrected'>", "transcript": "<best transcript>", "confidence": <0.0-1.0>, "reason": "<one short sentence>"}}"""def _extract_json(text: str):if not text:return Nonefenced = re.search(r"```(?:json)?\s*(\{.*?\})\s*```", text, re.S)if fenced:text = fenced.group(1)else:start, end = text.find("{"), text.rfind("}")if start == -1 or end <= start:return Nonetext = text[start : end + 1]try:return json.loads(text)except Exception: # noqa: BLE001return Nonedef judge_segment(audio_path, candidates: dict, reference_text: str = ""):"""Ask Nemotron which candidate matches the audio. Returns dict or None."""if not NEMOTRON_ENABLED or not candidates:return Nonecandidate_block = "\n".join(f'- key "{key}": {text!r}' for key, text in candidates.items() if text)reference_block = (f"The user supplied this reference transcript for the whole recording "f"(context only, it is not aligned to this segment):\n{reference_text!r}"if reference_textelse "")prompt = JUDGE_PROMPT.format(candidates=candidate_block, reference_block=reference_block)try:audio_b64 = base64.b64encode(Path(audio_path).read_bytes()).decode()response = nemotron_client().chat.completions.create(model=NEMOTRON_MODEL,messages=[{"role": "user","content": [{"type": "text", "text": prompt},{"type": "audio_url","audio_url": {"url": f"data:audio/wav;base64,{audio_b64}"},},],}],temperature=0,extra_body={"chat_template_kwargs": {"enable_thinking": False},"skip_special_tokens": False,},)verdict = _extract_json(response.choices[0].message.content or "")if not verdict or not verdict.get("transcript"):return Noneverdict.setdefault("best_source", "corrected")verdict.setdefault("confidence", None)verdict.setdefault("reason", "")return verdictexcept Exception as e: # noqa: BLE001print(f"Judge call failed: {e}")return Nonedef consensus_pick(candidates: dict):"""Fallback when no judge is configured: pick the medoid of the candidates."""items = [(k, v) for k, v in candidates.items() if v and v.strip()]28 unmodified linesdef _empty_outputs(audio_path, message):empty_df = [["", "", "", message]]return (empty_df, [[0.0, 0.0]], "",empty_df, [[0.0, 0.0]], "",empty_df, [[0.0, 0.0]], "",[["β", "β", "β", "β", "β", message]],17 unmodified linesuse_diarization,use_primeline,use_ultra,use_nemotron,):if not audio_path:return _empty_outputs(None, "No audio file provided.")81 unmodified linesgr.Warning(f"Parakeet Ultra failed: {e}", duration=5)results["parakeet_ultra"]["seconds"] = time.time() - t0# --- Nemotron (remote) ---if use_nemotron:if not NEMOTRON_ENABLED:results["nemotron"]["error"] = ("Endpoint not configured. Set NEMOTRON_BASE_URL and ""NEMOTRON_API_KEY as Space secrets.")else:gr.Info("Transcribing with Nemotron 3.5 Transcribe...", duration=2)t0 = time.time()try:results["nemotron"]["segments"] = transcribe_nemotron(transcribe_path)except Exception as e: # noqa: BLE001results["nemotron"]["error"] = str(e)gr.Warning(f"Nemotron failed: {e}", duration=5)results["nemotron"]["seconds"] = time.time() - t0# --- Post-process ---for key, _, _ in MODEL_SPECS:segs = results[key]["segments"]122 unmodified linesif reference_text:status_lines.append("WER/CER computed against your reference transcript")if not NEMOTRON_ENABLED:status_lines.append("Nemotron 3.5 Transcribe: endpoint not configured (see README)")gr.Info("Comparison complete!", duration=2)return (vis("primeline"), raw("primeline"), results["primeline"]["text"],vis("parakeet_ultra"), raw("parakeet_ultra"), results["parakeet_ultra"]["text"],vis("nemotron"), raw("nemotron"), results["nemotron"]["text"],metrics,speaker_turns_table(turns),diff_html,65 unmodified linesprimeline_raw,ultra_vis,ultra_raw,nemotron_vis,nemotron_raw,current_audio_path,):if selected_index is None or selected_index < 0:10 unmodified linestables = {"primeline": (primeline_vis, primeline_raw),"parakeet_ultra": (ultra_vis, ultra_raw),"nemotron": (nemotron_vis, nemotron_raw),}vis_data, raw_times = tables.get(source, (primeline_vis, primeline_raw))if not isinstance(raw_times, list) or selected_index >= len(raw_times):43 unmodified lineschannels=1,).export(audio_out, format="wav")verdict = judge_segment(audio_out.as_posix(), candidates, reference_text or "")judged_by = "nemotron-3.5-transcribe"if verdict is None:verdict = consensus_pick(candidates)judged_by = "consensus-fallback"if verdict is None:audio_out.unlink(missing_ok=True)return "β No usable transcript", ""16 unmodified lines"judge": judged_by,"judge_confidence": verdict.get("confidence"),"judge_reason": verdict.get("reason", ""),"verified_against_audio": judged_by == "nemotron-3.5-transcribe","candidates": candidates,"user_reference": reference_text or None,"wer_vs_reference": wer,23 unmodified linesexcept Exception as e: # noqa: BLE001print(f"Immediate donation push failed (scheduler will retry): {e}")source_label = MODEL_LABELS.get(verdict.get("best_source"), verdict.get("best_source"))if verdict.get("best_source") == "corrected":source_label = "judge-corrected transcript"elif verdict.get("best_source") == "user":source_label = "your reference transcript"detail = (f"**Stored transcript** ({source_label}): {best_text}\n\n"f"**Judge:** {judged_by}"+ (f" Β· confidence {verdict['confidence']}" if verdict.get("confidence") is not None else "")+ f"\n\n**Reason:** {verdict.get('reason') or 'β'}\n\n"f"**Candidates:** " + ", ".join(f"`{k}`" for k in candidates))gr.Info("β Snippet donated (judge-audited).", duration=3)return f"β Donated: '{best_text[:40]}β¦' ({end_time - start_time:.1f}s)", detail# === UI ===article = ("<p style='font-size: 1.1em;'>""This demo compares <strong>three speech recognition models</strong> side-by-side, ""with speaker diarization and optional reference-transcript scoring:""</p>""<ul style='font-size: 1.1em;'>"" <li><strong style='color: #22c55e;'>π’ Parakeet Primeline</strong> β our fine-tuned German Parakeet TDT</li>"" <li><strong style='color: #3b82f6;'>π΅ Parakeet Ultra</strong> β moondream's post-trained ""parakeet-tdt-0.6b-v3 (25 languages, Photon engine)</li>"" <li><strong style='color: #8b5cf6;'>π£ Nemotron 3.5 Transcribe 30B A4B</strong> β NVIDIA's ""speech-augmented LLM, 40 languages, 64k context (remote endpoint)</li>""</ul>""<p><strong style='color: #60a5fa; font-size: 1.2em;'>What you get:</strong></p>""<ul style='font-size: 1.1em;'>"3 unmodified lines" <li>Paste your own <strong>reference transcript</strong> to get WER and CER per model, ""with word-level diffs</li>"" <li>Click a segment to play it</li>"" <li>Donate a segment: the Nemotron judge listens to the audio, compares every candidate ""transcript and stores the best one β false donations are rejected</li>""</ul>")14 unmodified lines"<h1 style='text-align: center; margin: 0 auto;'>π¦ Parakeet Model Comparison π¦</h1>")gr.Markdown("<h3 style='text-align: center; color: #666;'>Primeline vs Parakeet Ultra vs Nemotron 3.5 Transcribe</h3>")gr.HTML(article)current_audio_path_state = gr.State(None)primeline_raw_state = gr.State([])ultra_raw_state = gr.State([])nemotron_raw_state = gr.State([])selected_segment_index = gr.State(-1)selected_source_state = gr.State("")# Default "" so the compare buttons work even if the load event has not20 unmodified linesuse_diarization_cb = gr.Checkbox(value=True, label="Speaker diarization")use_primeline_cb = gr.Checkbox(value=True, label="Parakeet Primeline")use_ultra_cb = gr.Checkbox(value=True, label="Parakeet Ultra")use_nemotron_cb = gr.Checkbox(value=True, label="Nemotron 3.5 Transcribe (remote)")status_md = gr.Markdown("")30 unmodified lineswrap=True, label="Primeline segments", type="array",)with gr.Row():with gr.Column():gr.Markdown("### π΅ Parakeet Ultra")ultra_df = gr.DataFrame(headers=["Start (s)", "End (s)", "Segment", "Speaker"],datatype=["number", "number", "str", "str"],wrap=True, label="Parakeet Ultra segments", type="array",)with gr.Column():gr.Markdown("### π£ Nemotron 3.5 Transcribe")nemotron_df = gr.DataFrame(headers=["Start (s)", "End (s)", "Segment", "Speaker"],datatype=["number", "number", "str", "str"],wrap=True, label="Nemotron segments", type="array",)with gr.Accordion("π£οΈ Speaker turns (diarization)", open=False):speaker_df = gr.Dataframe(8 unmodified linesgr.Markdown("<h3 style='text-align: center;'>π Donate Good Transcripts</h3>")gr.Markdown("<p style='text-align: center; color: #666;'>""Select a segment above, then donate it. The Nemotron judge listens to the audio, ""compares every candidate transcript (including yours) and stores the best one β ""so wrong or malicious transcripts never reach the dataset.""</p>")with gr.Row():9 unmodified lines# Hidden text states for full transcripts (kept for API consumers).primeline_text_state = gr.State("")ultra_text_state = gr.State("")nemotron_text_state = gr.State("")comparison_outputs = [primeline_df, primeline_raw_state, primeline_text_state,ultra_df, ultra_raw_state, ultra_text_state,nemotron_df, nemotron_raw_state, nemotron_text_state,metrics_df,speaker_df,diff_display,5 unmodified linescompare_inputs = [file_input, session_dir, reference_input,use_diarization_cb, use_primeline_cb, use_ultra_cb, use_nemotron_cb,]mic_inputs = [mic_input, session_dir, reference_input,use_diarization_cb, use_primeline_cb, use_ultra_cb, use_nemotron_cb,]file_transcribe_btn.click(11 unmodified linesdef _select_ultra(evt: gr.SelectData, raw, path):return play_segment(evt, raw, path, "parakeet_ultra")def _select_nemotron(evt: gr.SelectData, raw, path):return play_segment(evt, raw, path, "nemotron")primeline_df.select(fn=_select_primeline,inputs=[primeline_raw_state, current_audio_path_state],4 unmodified linesinputs=[ultra_raw_state, current_audio_path_state],outputs=[selected_segment_player, selected_segment_index, selected_source_state],)nemotron_df.select(fn=_select_nemotron,inputs=[nemotron_raw_state, current_audio_path_state],outputs=[selected_segment_player, selected_segment_index, selected_source_state],)donate_btn.click(fn=donate_snippet,inputs=[1 unmodified linereference_input,primeline_df, primeline_raw_state,ultra_df, ultra_raw_state,nemotron_df, nemotron_raw_state,current_audio_path_state,],outputs=[donation_status, donation_detail],5 unmodified linesprint("Launching Gradio Demo...")demo.queue()# Gradio 6: app-level theme moved from Blocks() to launch().demo.launch(theme=nvidia_theme)1234567891011126 unmodified lines19202122232435 unmodified lines60616263646549 unmodified lines115116117118119120238 unmodified lines35936036136236336436528 unmodified lines39439539639739839917 unmodified lines41741841942042142281 unmodified lines504505506507508509122 unmodified lines63263363463563663763863964064165 unmodified lines70770870971071171210 unmodified lines72372472572672772843 unmodified lines77277377477577677777877916 unmodified lines79679779879980080180223 unmodified lines8268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588593 unmodified lines86386486586686786886987014 unmodified lines88588688788888989089189289389489589689720 unmodified lines91891992092192292330 unmodified lines9549559569579589599609619629639649658 unmodified lines9749759769779789799809819829 unmodified lines992993994995996997998999100010015 unmodified lines1007100810091010101110121013101410151016101711 unmodified lines1029103010311032103310344 unmodified lines1039104010411042104310441 unmodified line1046104710481049105010515 unmodified lines1057105810591060"""Parakeet Model Comparison β Primeline vs Parakeet Ultra.Runs on a ZeroGPU Space. Both models run locally (NeMo Parakeet Primeline,Photon Parakeet Ultra) and speaker diarization runs locally (Nemotron 3Diarization).Optional reference transcript -> WER/CER per model.Donations are cross-checked against every candidate transcript before theyreach the dataset."""import os6 unmodified linesimport spaces # noqa: E402 (must come before torch)import csv # noqa: E402import datetime # noqa: E402import difflib # noqa: E40235 unmodified linesprint("Snippet donations will be saved locally only.")donation_scheduler = None# === Local models ===device = "cuda" if torch.cuda.is_available() else "cpu"49 unmodified linesMODEL_SPECS = [("primeline", "π’ Parakeet Primeline", "#22c55e"),("parakeet_ultra", "π΅ Parakeet Ultra", "#3b82f6"),]MODEL_LABELS = {key: label for key, label, _ in MODEL_SPECS}238 unmodified linesreturn segments# === Donation judge (consensus) ===def consensus_pick(candidates: dict):"""Fallback when no judge is configured: pick the medoid of the candidates."""items = [(k, v) for k, v in candidates.items() if v and v.strip()]28 unmodified linesdef _empty_outputs(audio_path, message):empty_df = [["", "", "", message]]return (empty_df, [[0.0, 0.0]], "",empty_df, [[0.0, 0.0]], "",[["β", "β", "β", "β", "β", message]],17 unmodified linesuse_diarization,use_primeline,use_ultra,):if not audio_path:return _empty_outputs(None, "No audio file provided.")81 unmodified linesgr.Warning(f"Parakeet Ultra failed: {e}", duration=5)results["parakeet_ultra"]["seconds"] = time.time() - t0# --- Post-process ---for key, _, _ in MODEL_SPECS:segs = results[key]["segments"]122 unmodified linesif reference_text:status_lines.append("WER/CER computed against your reference transcript")gr.Info("Comparison complete!", duration=2)return (vis("primeline"), raw("primeline"), results["primeline"]["text"],vis("parakeet_ultra"), raw("parakeet_ultra"), results["parakeet_ultra"]["text"],metrics,speaker_turns_table(turns),diff_html,65 unmodified linesprimeline_raw,ultra_vis,ultra_raw,current_audio_path,):if selected_index is None or selected_index < 0:10 unmodified linestables = {"primeline": (primeline_vis, primeline_raw),"parakeet_ultra": (ultra_vis, ultra_raw),}vis_data, raw_times = tables.get(source, (primeline_vis, primeline_raw))if not isinstance(raw_times, list) or selected_index >= len(raw_times):43 unmodified lineschannels=1,).export(audio_out, format="wav")verdict = consensus_pick(candidates)judged_by = "consensus-fallback"if verdict is None:audio_out.unlink(missing_ok=True)return "β No usable transcript", ""16 unmodified lines"judge": judged_by,"judge_confidence": verdict.get("confidence"),"judge_reason": verdict.get("reason", ""),"verified_against_audio": False,"candidates": candidates,"user_reference": reference_text or None,"wer_vs_reference": wer,23 unmodified linesexcept Exception as e: # noqa: BLE001print(f"Immediate donation push failed (scheduler will retry): {e}")best_source = verdict.get("best_source") or "corrected"source_label = MODEL_LABELS.get(best_source, best_source)if best_source == "corrected":source_label = "consensus transcript"elif best_source == "user":source_label = "your reference transcript"detail = (f"**Stored transcript** ({source_label}): {best_text}\n\n"f"**Audit:** {judged_by}"+ (f" Β· confidence {verdict['confidence']}" if verdict.get("confidence") is not None else "")+ f"\n\n**Reason:** {verdict.get('reason') or 'β'}\n\n"f"**Candidates:** " + ", ".join(f"`{k}`" for k in candidates))gr.Info("β Snippet donated (consensus-audited).", duration=3)return f"β Donated: '{best_text[:40]}β¦' ({end_time - start_time:.1f}s)", detail# === UI ===article = ("<p style='font-size: 1.1em;'>""This demo compares <strong>two speech recognition models</strong> side-by-side, ""with speaker diarization and optional reference-transcript scoring:""</p>""<ul style='font-size: 1.1em;'>"" <li><strong style='color: #22c55e;'>π’ Parakeet Primeline</strong> β our fine-tuned German Parakeet TDT</li>"" <li><strong style='color: #3b82f6;'>π΅ Parakeet Ultra</strong> β moondream's post-trained ""parakeet-tdt-0.6b-v3 (25 languages, Photon engine)</li>""</ul>""<p><strong style='color: #60a5fa; font-size: 1.2em;'>What you get:</strong></p>""<ul style='font-size: 1.1em;'>"3 unmodified lines" <li>Paste your own <strong>reference transcript</strong> to get WER and CER per model, ""with word-level diffs</li>"" <li>Click a segment to play it</li>"" <li>Donate a segment: every candidate transcript is cross-checked and the ""consensus one is stored β false donations are rejected</li>""</ul>")14 unmodified lines"<h1 style='text-align: center; margin: 0 auto;'>π¦ Parakeet Model Comparison π¦</h1>")gr.Markdown("<h3 style='text-align: center; color: #666;'>Primeline vs Parakeet Ultra</h3>")gr.HTML(article)current_audio_path_state = gr.State(None)primeline_raw_state = gr.State([])ultra_raw_state = gr.State([])selected_segment_index = gr.State(-1)selected_source_state = gr.State("")# Default "" so the compare buttons work even if the load event has not20 unmodified linesuse_diarization_cb = gr.Checkbox(value=True, label="Speaker diarization")use_primeline_cb = gr.Checkbox(value=True, label="Parakeet Primeline")use_ultra_cb = gr.Checkbox(value=True, label="Parakeet Ultra")status_md = gr.Markdown("")30 unmodified lineswrap=True, label="Primeline segments", type="array",)gr.Markdown("### π΅ Parakeet Ultra")ultra_df = gr.DataFrame(headers=["Start (s)", "End (s)", "Segment", "Speaker"],datatype=["number", "number", "str", "str"],wrap=True, label="Parakeet Ultra segments", type="array",)with gr.Accordion("π£οΈ Speaker turns (diarization)", open=False):speaker_df = gr.Dataframe(8 unmodified linesgr.Markdown("<h3 style='text-align: center;'>π Donate Good Transcripts</h3>")gr.Markdown("<p style='text-align: center; color: #666;'>""Select a segment above, then donate it. Every candidate transcript (including ""yours) is cross-checked and the consensus one is stored β so wrong or malicious ""transcripts never reach the dataset.""</p>")with gr.Row():9 unmodified lines# Hidden text states for full transcripts (kept for API consumers).primeline_text_state = gr.State("")ultra_text_state = gr.State("")comparison_outputs = [primeline_df, primeline_raw_state, primeline_text_state,ultra_df, ultra_raw_state, ultra_text_state,metrics_df,speaker_df,diff_display,5 unmodified linescompare_inputs = [file_input, session_dir, reference_input,use_diarization_cb, use_primeline_cb, use_ultra_cb,]mic_inputs = [mic_input, session_dir, reference_input,use_diarization_cb, use_primeline_cb, use_ultra_cb,]file_transcribe_btn.click(11 unmodified linesdef _select_ultra(evt: gr.SelectData, raw, path):return play_segment(evt, raw, path, "parakeet_ultra")primeline_df.select(fn=_select_primeline,inputs=[primeline_raw_state, current_audio_path_state],4 unmodified linesinputs=[ultra_raw_state, current_audio_path_state],outputs=[selected_segment_player, selected_segment_index, selected_source_state],)donate_btn.click(fn=donate_snippet,inputs=[1 unmodified linereference_input,primeline_df, primeline_raw_state,ultra_df, ultra_raw_state,current_audio_path_state,],outputs=[donation_status, donation_detail],5 unmodified linesprint("Launching Gradio Demo...")demo.queue()# Gradio 6: app-level theme moved from Blocks() to launch().demo.launch(theme=nvidia_theme)
6 unmodified lines789106 unmodified linesacceleratemoondream>=2.6.1jiweropenai6 unmodified lines7896 unmodified linesacceleratemoondream>=2.6.1jiwer
README.md+55-86
app.py+33-244
requirements.txt-1