Sync from GitHub via hub-sync
Browse files- BENCHMARKS.md +47 -0
- MODELS.md +40 -0
- README.md +126 -152
- SERVING.md +61 -0
BENCHMARKS.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Transcription benchmarks
|
| 2 |
+
|
| 3 |
+
> Part of [uv-scripts/transcription](README.md).
|
| 4 |
+
|
| 5 |
+
CBS Suspense (1940s radio drama), 66 episodes, 33 hours of audio.
|
| 6 |
+
|
| 7 |
+
**`cohere-transcribe.py`** (plain text):
|
| 8 |
+
|
| 9 |
+
| GPU | Time | RTFx |
|
| 10 |
+
|-----|------|------|
|
| 11 |
+
| A100-SXM4-80GB | 12.3 min | 161x realtime |
|
| 12 |
+
| L4 | ~64s / 30 min episode | 28x realtime |
|
| 13 |
+
|
| 14 |
+
**`buzzasr-transcribe.py`** (Dutch LibriVox audiobook, 4 chapters, 178 min; Armenian CC0 news/talk from the Internet Archive, 3 files, 25 min):
|
| 15 |
+
|
| 16 |
+
| Run | GPU | Time | RTFx | Peak GPU | Words out |
|
| 17 |
+
|-----|-----|------|------|----------|-----------|
|
| 18 |
+
| `BuzzASR/dutch`, sequential (default) | L4 | 8.9 min | 20x | 4.5 GB | 27,438 |
|
| 19 |
+
| `BuzzASR/dutch`, `--long-form chunked` | L4 | 3.5 min | 51x | 7.5 GB | 23,669 (−14%; sentences dropped at merges) |
|
| 20 |
+
| `openai/whisper-large-v3` control, sequential | L4 | 13.4 min | 13x | 4.3 GB | 27,688 (punctuated + cased; 14% word disagreement with BuzzASR; single-file batches, before the batching refactor) |
|
| 21 |
+
| `openai/whisper-large-v3` control, chunked | L4 | 4.5 min | 40x | 7.6 GB | 19,925 (−28% vs its own sequential run) |
|
| 22 |
+
| `BuzzASR/armenian`, sequential (25 min, 3 files) | L4 | 1.9 min | 13x | 4.1 GB | 2,198 words on the 19.5-min programme, coherent Armenian |
|
| 23 |
+
| `openai/whisper-large-v3` control, sequential, same files | L4 | 14.8 min | 2x | 4.5 GB | 582 words on the same programme, garbled + mojibake |
|
| 24 |
+
|
| 25 |
+
Peak host memory for the 178-min sequential batch was 9.0 GB; with the transformers docs' `logprob_threshold` fallback it was 17.6 GB, because that setting keeps every token's full-vocabulary scores on the host, and the output was identical without it, so the recipe leaves it out. No ground truth for either set: word counts and per-file diffs measure completeness, not accuracy. Two things follow. The chunked pipeline's losses are the pipeline's, not the model's (Whisper-large-v3 loses 28% of its words the same way), so `sequential` is the default for both. And on Dutch, a language Whisper already handles well (the authors report a 1.3x CER gain), zero-shot Whisper-large-v3 with the same sequential decoding was as complete and kept punctuation and casing, so the fine-tunes earn their place on the languages Whisper handles badly: on Armenian (6.8x claimed CER gain) the control produced a quarter of the words, garbled, at 2x realtime because its temperature fallback fired on almost every window.
|
| 26 |
+
|
| 27 |
+
**`easytranscriber-transcribe.py`** (JSON alignments + optional .txt/.srt; VAD → ASR → wav2vec2 → forced alignment):
|
| 28 |
+
|
| 29 |
+
| GPU | Time | RTFx | Output |
|
| 30 |
+
|-----|------|------|--------|
|
| 31 |
+
| L4 | 46.2 min | 42.9x realtime | 66 JSON + SRT + TXT (42,633 segments, 295k words) |
|
| 32 |
+
|
| 33 |
+
**`moss-transcribe-diarize.py`** (Apollo 11 mission audio, one 74-min multi-speaker tape):
|
| 34 |
+
|
| 35 |
+
| GPU | Time | RTFx | Output |
|
| 36 |
+
|-----|------|------|--------|
|
| 37 |
+
| A10G | 23.3 min | 3.2x realtime | 743 segments, 7 speakers, 23k tokens, no truncation |
|
| 38 |
+
|
| 39 |
+
Long files are generation-bound (the whole diarized transcript is decoded in one pass), so RTFx drops as recordings grow; short clips run far faster. `l4x1` also works — same class of GPU.
|
| 40 |
+
|
| 41 |
+
**`moss-transcribe-diarize-server.py`** (Apollo 11 mission audio from the [Internet Archive](https://archive.org/details/Apollo11Audio) — the full collection in one job):
|
| 42 |
+
|
| 43 |
+
| GPU | Audio | Time | RTFx | Cost | Output |
|
| 44 |
+
|-----|-------|------|------|------|--------|
|
| 45 |
+
| A100 | 174.5 h (103 tapes) | 3.8 h | 47.4x realtime aggregate | $9.46 | 45k speaker segments, 97% coverage |
|
| 46 |
+
|
| 47 |
+
Result published as [`davanstrien/apollo-11-diarized`](https://huggingface.co/datasets/davanstrien/apollo-11-diarized) with a searchable demo at [`davanstrien/apollo-11-search`](https://huggingface.co/spaces/davanstrien/apollo-11-search).
|
MODELS.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Transcription scripts: model notes
|
| 2 |
+
|
| 3 |
+
> Part of [uv-scripts/transcription](README.md).
|
| 4 |
+
|
| 5 |
+
What each script does, what it costs and what we measured. The [README](README.md) has the Quick Start and a table for picking a script.
|
| 6 |
+
|
| 7 |
+
| Script | Model | Backend | Output | Speed |
|
| 8 |
+
|--------|-------|---------|--------|-------|
|
| 9 |
+
| `cohere-transcribe.py` | Cohere Transcribe (2B) | transformers | `.txt` | 161x RT (A100) |
|
| 10 |
+
| `cohere-transcribe-vllm.py` | Cohere Transcribe (2B) | vLLM nightly | `.txt` | 214x RT (A100) |
|
| 11 |
+
| `granite-turboctc-transcribe.py` | [Granite Speech 5.0 TurboCTC](https://huggingface.co/ibm-granite/granite-speech-5.0-470m-turboctc) (470M, English) | transformers (pinned `main`) | `.txt` (lowercase, no punctuation) | 594x RT wall / ~5000x GPU-only (A100); 504x RT wall (A10G) |
|
| 12 |
+
| `buzzasr-transcribe.py` | [BuzzASR](https://huggingface.co/BuzzASR) (102 monolingual Whisper-large-v3 fine-tunes, 1.55B) | transformers | `.txt` (mostly lowercase, no punctuation) | 20x RT (L4, sequential) / 51x RT (L4, chunked) |
|
| 13 |
+
| `easytranscriber-transcribe.py` | Cohere Transcribe 2B (default) or Whisper variants | [easytranscriber](https://github.com/kb-labb/easytranscriber) | JSON word timestamps (+ optional `.txt` / `.srt`) | 42.9x RT (L4) |
|
| 14 |
+
| `moss-transcribe-diarize.py` | [MOSS-Transcribe-Diarize](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize) (0.9B) | transformers (remote code) | JSON speaker segments `{start, end, speaker, text}` (+ optional `.txt` / `.srt`) | 3.2x RT (A10G, 74-min file) |
|
| 15 |
+
| `moss-transcribe-diarize-server.py` | [MOSS-Transcribe-Diarize](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize) (0.9B) | in-job sgl-omni server | JSON speaker segments (+ optional `.txt`) | 47.4x RT aggregate (A100, 6 streams) |
|
| 16 |
+
| `nemotron-transcribe.py` | [Nemotron 3.5 Transcribe](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B) (30B MoE, ~4B active, 40 languages) | in-job vLLM 0.32 + NeMo Speech server | `.txt` (+ JSON word timestamps, speakers and diarization with `--timestamps`) | 116x RT aggregate (RTX PRO 6000, 10 files) + ~8 min fixed setup |
|
| 17 |
+
| `nemotron-transcribe-saturate.py` | Nemotron 3.5 Transcribe (same model) | in-job SGLang-Omni server, driven by [saturate](https://github.com/davanstrien/saturate) | parquet `{id, text, finish_reason, duration_s, model, prompt, error}` | 81x RT aggregate (RTX PRO 6000, 10 files) + ~9 min fixed setup |
|
| 18 |
+
|
| 19 |
+
**`cohere-transcribe.py`** (recommended for plain text) — uses `model.transcribe()` with automatic long-form chunking, overlap, and reassembly. Stable dependencies.
|
| 20 |
+
|
| 21 |
+
**`cohere-transcribe-vllm.py`** — experimental vLLM variant. Faster but requires nightly vLLM and has minor duplication at chunk boundaries.
|
| 22 |
+
|
| 23 |
+
**`granite-turboctc-transcribe.py`** — when you have **a lot of English audio** and want raw text fast. Encoder-only CTC (one forward pass + argmax, no autoregressive decoding), so it cannot loop or hallucinate and the GPU is essentially idle: 5 hours of 1940s radio ran in 3.2 s of GPU time on an A100 (~30x Cohere), with the job's wall time dominated by mp3 decoding and model load. Output is lowercase without punctuation or casing, and quality is a step below Cohere on hard audio (~8.5% word disagreement with Cohere's transcripts on the same episodes, no ground truth). Files are fed whole by default — block attention makes cost linear in length and a 30-min file needs ~2.5 GB — with `--chunk-seconds 30` for hour-plus files or a 24 GB card. Needs `transformers` from `main` (support landed 2026-08-25, pinned to a commit) until the next release; English only.
|
| 24 |
+
|
| 25 |
+
**`buzzasr-transcribe.py`** — when the audio is in **a language Cohere doesn't cover** (Armenian, Amharic, Georgian, Khmer, Lao, Sorani Kurdish, Wolof, Yoruba, …): one model per language for 102 FLEURS languages. [BuzzASR](https://lemn-lab.github.io/buzz-asr/) (Findings of EMNLP 2026, MIT) fine-tunes Whisper-large-v3 once per FLEURS language, with a native tokenizer for the languages Whisper's tokenizer fragments; the authors report lower CER than Whisper-large-v3 zero-shot on 89/102 languages and the lowest of any open system on 31. Pass `--language armenian` (or the ISO code `hy`) and the matching `BuzzASR/<language>` checkpoint is loaded: every card tags both the name and the code, so the recipe resolves either with a tag filter on the org at run time (no table to maintain; new languages just work). Finding a model by hand is the same one-liner: `hf models list --author BuzzASR --filter ckb --format quiet` → `BuzzASR/sorani-kurdish`, or `--search kurdish` by name. The language prompt is baked into each model, so the model is never asked to detect the language. Default long-form decoding is Whisper's sequential algorithm (timestamps place each window, degenerate windows are re-decoded at higher temperature), which skipped no windows in our tests but is ~2.5x slower than `--long-form chunked` (the transformers pipeline), whose overlap merge drops text: on 3 h of Dutch audiobook the chunked run produced 14% fewer words than sequential, with whole sentences missing. Generation uses the authors' settings (greedy, no repeated 3-gram, repetition penalty 1.2), which also stop a genuinely repeated phrase from being written twice inside one 30 s window. Output is normalised like the training data (mostly lowercase, no punctuation); for a language Whisper already covers well, `openai/whisper-large-v3` through the same recipe gives punctuated, cased text of the same completeness (see [BENCHMARKS.md](BENCHMARKS.md)), so reach for BuzzASR where Whisper is weak. The recipe rebuilds each model's `generation_config.json` on load: the native-tokenizer checkpoints ship it flagged `_from_model_config`, which makes transformers drop the language prompt and timestamp ids and breaks long-form generation. `--model openai/whisper-large-v3` runs the zero-shot base through the same loop as a control.
|
| 26 |
+
|
| 27 |
+
**`easytranscriber-transcribe.py`** — when you need **word-level timestamps** (subtitles, search indexing, forced alignment). Runs VAD → ASR → wav2vec2 emissions → forced alignment. Defaults to the Cohere backend so you get the same model as the other scripts with alignment on top; swap to `--backend ct2` + a Whisper model for languages Cohere doesn't cover (e.g. Swedish via `KBLab/kb-whisper-large`).
|
| 28 |
+
|
| 29 |
+
**`moss-transcribe-diarize.py`** — when you need **who said what**. Joint transcription + speaker diarization + timestamps in one generation pass (no separate ASR/diarization/alignment stages). 128k context handles up to ~90 min of audio per file internally, so files are never pre-chunked and the anonymous speaker labels (`[S01]`, `[S02]`, ...) stay consistent across the whole recording. English + Chinese; also accepts video containers (mp4, mkv, ...); supports hotword biasing for names/jargon.
|
| 30 |
+
|
| 31 |
+
**`moss-transcribe-diarize-server.py`** — same model at **~12x the throughput** for many files: serves it behind sglang-omni inside the job and posts files concurrently (continuous batching). Splits long tapes into ≤55-min clips to fit the context window (speaker labels reset between clips, recorded as `part` on each segment) and automatically continues from the last timestamp when the model stops early, reporting `coverage_s` per file. Needs `a100-large` — 24 GB cards OOM on long-tape KV. The `hf jobs run` command lives in the script docstring (server + driver in one job).
|
| 32 |
+
|
| 33 |
+
**`nemotron-transcribe.py`** — when you want **punctuated text, speaker tags and word timestamps from one model, in 40 languages** (speaker tags in 13, up to 8 speakers), and have enough audio to amortise a fixed ~8 min setup. The model only serves on vLLM 0.32.0 with the NeMo Speech plugin, so the script starts that server inside the job and posts files concurrently: 10 half-hour 1940s radio episodes (4.9 h) took 2.5 min once the server was up, a $0.48 job on `rtx-pro-6000`. The `[tool.hf-jobs]` header sets the flavor and a prebuilt image (`cr.hf.co/davanstrien/nemotron-transcribe`, built in a Job by `nemotron-transcribe-image.sh`) that pins NeMo Speech to one commit and carries FlashInfer kernels already compiled for that GPU. `--image vllm/vllm-openai:v0.32.0` makes the script install the stack at runtime instead (~2 min slower; it downloads FlashInfer's precompiled kernels). Prompts are the model card's presets (`--style verbatim|clean|speakers`, or `--prompt` with `Context terms: <names>` for jargon), and the card's generation-loop guardrail is applied to every transcript. `--timestamps` adds a JSON per file with word start/end times, speaker tags and diarization segments, from the CTC head bundled in the checkpoint. Files over 55 min are split into equal parts, and speaker tags reset between parts. On the same 10 episodes, after Whisper-style text normalisation, its words differ from Cohere's by 7.0% (Granite vs Cohere: 7.7%; Nemotron vs Granite: 8.4%); there is no ground truth for these episodes, so this measures agreement, not accuracy. Once loaded it matches Cohere's speed (116x vs 120x RT on the same audio), but the fixed setup makes a 5-hour batch cost $0.48 against Cohere's $0.16 and Granite's $0.20, so reach for it when you need the speaker tags, timestamps or languages. The vLLM integration is NVIDIA's development path; the card says it is about 2x slower than their NIM.
|
| 34 |
+
|
| 35 |
+
**`nemotron-transcribe-saturate.py`** — the same model on **SGLang-Omni** (no NeMo), with saturate as the driver: a fixed window of files in flight (`--concurrency`), resumable parquet output keyed by input path, and durable error rows (`--retry-errors`). Input is a glob (`"hf://buckets/user/audio/**/*.mp3"`), output a dataset id or fsspec URI. It is plain transcription only, because SGLang-Omni's integration has no timestamps, speaker tags or translation; each file is one request of up to an hour. On the same 10 episodes it ran at 81x realtime once up (vLLM path: 116x) in a 12.8 min job; its text differs from the vLLM recipe's by 2.4% of words and from Cohere's by 7.3%, with no looping or truncated files. Two workarounds are pinned in its `SERVING` dict. The model card names SGLang-Omni 0.2.0, but that wheel predates the Nemotron integration, so a `main` commit is installed. The integration also expects the architecture name `NeMoSpeechLMForConditionalGeneration` while the Hub checkpoint declares `Nemotron3_5TranscribeForConditionalGeneration`, so the local copy's `config.json` is renamed before serving.
|
| 36 |
+
|
| 37 |
+
## Notes
|
| 38 |
+
|
| 39 |
+
- **Tokenizer workaround**: `cohere-transcribe.py` applies a one-line patch for a tokenizer compat issue. Will be removed once upstream fixes land ([model discussion](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026/discussions/11)).
|
| 40 |
+
- **moss-transcribe-diarize**: not gated (Apache 2.0). Uses `trust_remote_code=True` (model code lives in the [model repo](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize)); inference helpers install from the model's [GitHub repo](https://github.com/OpenMOSS/MOSS-Transcribe-Diarize) pinned to a commit (the package isn't on PyPI). Generation time scales with audio length — long multi-speaker recordings emit tens of thousands of tokens, so watch the `truncated` flag in the output JSON.
|
README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
viewer: false
|
| 3 |
tags:
|
| 4 |
- uv-script
|
|
|
|
| 5 |
- audio
|
| 6 |
- transcription
|
| 7 |
- automatic-speech-recognition
|
|
@@ -9,94 +10,124 @@ tags:
|
|
| 9 |
- multilingual
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Transcription
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
## Quick Start
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
```bash
|
| 21 |
-
|
| 22 |
-
hf jobs uv run \
|
| 23 |
-
-v hf://buckets/
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
|
| 28 |
-
hf jobs uv run --flavor l4x1 -s HF_TOKEN \
|
| 29 |
-
-e UV_TORCH_BACKEND=cu128 \
|
| 30 |
-
-v hf://buckets/user/audio-files:/input:ro \
|
| 31 |
-
-v hf://buckets/user/transcripts:/output \
|
| 32 |
-
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/cohere-transcribe.py \
|
| 33 |
-
/input /output --language en --compile
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
-e UV_TORCH_BACKEND=cu128 \
|
| 38 |
-
-v hf://buckets/
|
| 39 |
-
-v hf://buckets/
|
| 40 |
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/moss-transcribe-diarize.py \
|
| 41 |
/input /output --emit-txt
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
Audio already on your machine? Mount the folder directly — `-v ./audio:/input` syncs it to a private bucket and mounts it in the job (re-runs only sync changed files; `huggingface_hub` ≥ 1.22), so you can skip the `download-ia`/bucket step.
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
##
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|--------|-------|---------|--------|-------|
|
| 56 |
-
| `cohere-transcribe.py` | Cohere Transcribe (2B) | transformers | `.txt` | 161x RT (A100) |
|
| 57 |
-
| `cohere-transcribe-vllm.py` | Cohere Transcribe (2B) | vLLM nightly | `.txt` | 214x RT (A100) |
|
| 58 |
-
| `granite-turboctc-transcribe.py` | [Granite Speech 5.0 TurboCTC](https://huggingface.co/ibm-granite/granite-speech-5.0-470m-turboctc) (470M, English) | transformers (pinned `main`) | `.txt` (lowercase, no punctuation) | 594x RT wall / ~5000x GPU-only (A100); 504x RT wall (A10G) |
|
| 59 |
-
| `buzzasr-transcribe.py` | [BuzzASR](https://huggingface.co/BuzzASR) (102 monolingual Whisper-large-v3 fine-tunes, 1.55B) | transformers | `.txt` (mostly lowercase, no punctuation) | 20x RT (L4, sequential) / 51x RT (L4, chunked) |
|
| 60 |
-
| `easytranscriber-transcribe.py` | Cohere Transcribe 2B (default) or Whisper variants | [easytranscriber](https://github.com/kb-labb/easytranscriber) | JSON word timestamps (+ optional `.txt` / `.srt`) | 42.9x RT (L4) |
|
| 61 |
-
| `moss-transcribe-diarize.py` | [MOSS-Transcribe-Diarize](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize) (0.9B) | transformers (remote code) | JSON speaker segments `{start, end, speaker, text}` (+ optional `.txt` / `.srt`) | 3.2x RT (A10G, 74-min file) |
|
| 62 |
-
| `moss-transcribe-diarize-server.py` | [MOSS-Transcribe-Diarize](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize) (0.9B) | in-job sgl-omni server | JSON speaker segments (+ optional `.txt`) | 47.4x RT aggregate (A100, 6 streams) |
|
| 63 |
-
| `nemotron-transcribe.py` | [Nemotron 3.5 Transcribe](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B) (30B MoE, ~4B active, 40 languages) | in-job vLLM 0.32 + NeMo Speech server | `.txt` (+ JSON word timestamps, speakers and diarization with `--timestamps`) | 116x RT aggregate (RTX PRO 6000, 10 files) + ~8 min fixed setup |
|
| 64 |
-
| `nemotron-transcribe-saturate.py` | Nemotron 3.5 Transcribe (same model) | in-job SGLang-Omni server, driven by [saturate](https://github.com/davanstrien/saturate) | parquet `{id, text, finish_reason, duration_s, model, prompt, error}` | 81x RT aggregate (RTX PRO 6000, 10 files) + ~9 min fixed setup |
|
| 65 |
|
| 66 |
-
**
|
| 67 |
|
| 68 |
-
**`
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
|
|
|
|
| 81 |
|
| 82 |
-
|
| 83 |
|
| 84 |
```bash
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
--
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
uv run https://huggingface.co/datasets/uv-scripts/transcription/raw/main/nemotron-transcribe.py \
|
| 92 |
-
./audio ./transcripts --server https://<job_id>--8000.hf.jobs
|
| 93 |
```
|
| 94 |
|
| 95 |
-
|
|
|
|
|
|
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
| Flag | Default | Description |
|
| 102 |
|------|---------|-------------|
|
|
@@ -112,7 +143,10 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 112 |
| `--request-timeout` | 3600 | Per-request timeout in seconds |
|
| 113 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 114 |
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
| Flag | Default | Description |
|
| 118 |
|------|---------|-------------|
|
|
@@ -121,7 +155,22 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 121 |
| `--batch-size` | 16 | Batch size for inference |
|
| 122 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 123 |
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
| Flag | Default | Description |
|
| 127 |
|------|---------|-------------|
|
|
@@ -130,7 +179,10 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 130 |
| `--decode-workers` | CPU count | Threads for mp3/wav decoding, overlapped with model load and inference |
|
| 131 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 132 |
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
| Flag | Default | Description |
|
| 136 |
|------|---------|-------------|
|
|
@@ -141,11 +193,14 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 141 |
| `--decode-workers` | CPU count | Threads for mp3/wav decoding, overlapped with model load |
|
| 142 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 143 |
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
| Flag | Default | Description |
|
| 147 |
|------|---------|-------------|
|
| 148 |
-
| `--language` | required | ISO 639-1 code. Cohere supports the same 14 languages as
|
| 149 |
| `--backend` | `cohere` | `cohere`, `ct2` (CTranslate2 Whisper, fastest for Whisper), or `hf` (transformers) |
|
| 150 |
| `--transcription-model` | Cohere 2B / distil-whisper-large-v3.5 | HF model ID; override to use KB-Whisper, Whisper-large-v3, etc. |
|
| 151 |
| `--emissions-model` | per-language default | wav2vec2 for forced alignment: en→`wav2vec2-base-960h`, sv→`voxrex-swedish`, else→`facebook/mms-1b-all` |
|
|
@@ -157,7 +212,10 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 157 |
| `--batch-size-transcribe` | 16 | ASR batch size (where backend supports it) |
|
| 158 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 159 |
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
| Flag | Default | Description |
|
| 163 |
|------|---------|-------------|
|
|
@@ -168,7 +226,10 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 168 |
| `--emit-txt` | off | Also write `.txt` transcripts |
|
| 169 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 170 |
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
| Flag | Default | Description |
|
| 174 |
|------|---------|-------------|
|
|
@@ -179,97 +240,10 @@ For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--
|
|
| 179 |
| `--emit-srt` | off | Also write `.srt` subtitles with speaker prefixes |
|
| 180 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 181 |
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
CBS Suspense (1940s radio drama), 66 episodes, 33 hours of audio.
|
| 185 |
-
|
| 186 |
-
**`cohere-transcribe.py`** (plain text):
|
| 187 |
-
|
| 188 |
-
| GPU | Time | RTFx |
|
| 189 |
-
|-----|------|------|
|
| 190 |
-
| A100-SXM4-80GB | 12.3 min | 161x realtime |
|
| 191 |
-
| L4 | ~64s / 30 min episode | 28x realtime |
|
| 192 |
-
|
| 193 |
-
**`buzzasr-transcribe.py`** (Dutch LibriVox audiobook, 4 chapters, 178 min; Armenian CC0 news/talk from the Internet Archive, 3 files, 25 min):
|
| 194 |
-
|
| 195 |
-
| Run | GPU | Time | RTFx | Peak GPU | Words out |
|
| 196 |
-
|-----|-----|------|------|----------|-----------|
|
| 197 |
-
| `BuzzASR/dutch`, sequential (default) | L4 | 8.9 min | 20x | 4.5 GB | 27,438 |
|
| 198 |
-
| `BuzzASR/dutch`, `--long-form chunked` | L4 | 3.5 min | 51x | 7.5 GB | 23,669 (−14%; sentences dropped at merges) |
|
| 199 |
-
| `openai/whisper-large-v3` control, sequential | L4 | 13.4 min | 13x | 4.3 GB | 27,688 (punctuated + cased; 14% word disagreement with BuzzASR; single-file batches, before the batching refactor) |
|
| 200 |
-
| `openai/whisper-large-v3` control, chunked | L4 | 4.5 min | 40x | 7.6 GB | 19,925 (−28% vs its own sequential run) |
|
| 201 |
-
| `BuzzASR/armenian`, sequential (25 min, 3 files) | L4 | 1.9 min | 13x | 4.1 GB | 2,198 words on the 19.5-min programme, coherent Armenian |
|
| 202 |
-
| `openai/whisper-large-v3` control, sequential, same files | L4 | 14.8 min | 2x | 4.5 GB | 582 words on the same programme, garbled + mojibake |
|
| 203 |
-
|
| 204 |
-
Peak host memory for the 178-min sequential batch was 9.0 GB; with the transformers docs' `logprob_threshold` fallback it was 17.6 GB, because that setting keeps every token's full-vocabulary scores on the host, and the output was identical without it, so the recipe leaves it out. No ground truth for either set: word counts and per-file diffs measure completeness, not accuracy. Two things follow. The chunked pipeline's losses are the pipeline's, not the model's (Whisper-large-v3 loses 28% of its words the same way), so `sequential` is the default for both. And on Dutch, a language Whisper already handles well (the authors report a 1.3x CER gain), zero-shot Whisper-large-v3 with the same sequential decoding was as complete and kept punctuation and casing, so the fine-tunes earn their place on the languages Whisper handles badly: on Armenian (6.8x claimed CER gain) the control produced a quarter of the words, garbled, at 2x realtime because its temperature fallback fired on almost every window.
|
| 205 |
-
|
| 206 |
-
**`easytranscriber-transcribe.py`** (JSON alignments + optional .txt/.srt; VAD → ASR → wav2vec2 → forced alignment):
|
| 207 |
-
|
| 208 |
-
| GPU | Time | RTFx | Output |
|
| 209 |
-
|-----|------|------|--------|
|
| 210 |
-
| L4 | 46.2 min | 42.9x realtime | 66 JSON + SRT + TXT (42,633 segments, 295k words) |
|
| 211 |
-
|
| 212 |
-
**`moss-transcribe-diarize.py`** (Apollo 11 mission audio, one 74-min multi-speaker tape):
|
| 213 |
-
|
| 214 |
-
| GPU | Time | RTFx | Output |
|
| 215 |
-
|-----|------|------|--------|
|
| 216 |
-
| A10G | 23.3 min | 3.2x realtime | 743 segments, 7 speakers, 23k tokens, no truncation |
|
| 217 |
-
|
| 218 |
-
Long files are generation-bound (the whole diarized transcript is decoded in one pass), so RTFx drops as recordings grow; short clips run far faster. `l4x1` also works — same class of GPU.
|
| 219 |
-
|
| 220 |
-
**`moss-transcribe-diarize-server.py`** (Apollo 11 mission audio from the [Internet Archive](https://archive.org/details/Apollo11Audio) — the full collection in one job):
|
| 221 |
-
|
| 222 |
-
| GPU | Audio | Time | RTFx | Cost | Output |
|
| 223 |
-
|-----|-------|------|------|------|--------|
|
| 224 |
-
| A100 | 174.5 h (103 tapes) | 3.8 h | 47.4x realtime aggregate | $9.46 | 45k speaker segments, 97% coverage |
|
| 225 |
-
|
| 226 |
-
Result published as [`davanstrien/apollo-11-diarized`](https://huggingface.co/datasets/davanstrien/apollo-11-diarized) with a searchable demo at [`davanstrien/apollo-11-search`](https://huggingface.co/spaces/davanstrien/apollo-11-search).
|
| 227 |
-
|
| 228 |
-
### Data
|
| 229 |
-
|
| 230 |
-
| Script | Description |
|
| 231 |
-
|--------|-------------|
|
| 232 |
-
| `download-ia.py` | Download audio from Internet Archive into a mounted bucket |
|
| 233 |
-
|
| 234 |
-
## Serve as a live endpoint
|
| 235 |
-
|
| 236 |
-
MOSS-Transcribe-Diarize can be served as an OpenAI-compatible transcription API on Jobs (see [Serving on Jobs](https://huggingface.co/docs/hub/jobs-serving)). Two verified paths; both expose `/v1/audio/transcriptions` at `https://<job-id>--8000.hf.jobs` (requests need an HF token with read access to your namespace).
|
| 237 |
-
|
| 238 |
-
**vLLM** (simplest; returns the raw `[start][Sxx]text[end]` transcript). Model support was merged into vLLM on 2026-07-08 — after the v0.24.0 release — so use a commit-pinned nightly image until the next release (then plain `vllm/vllm-openai:latest` works). The image needs the audio extras installed first:
|
| 239 |
-
|
| 240 |
-
```bash
|
| 241 |
-
hf jobs run --detach --expose 8000 --flavor l4x1 -s HF_TOKEN --timeout 2h \
|
| 242 |
-
vllm/vllm-openai:nightly-2c17d33f4291a55b447317640c81eb61077b1b00 -- \
|
| 243 |
-
bash -c "pip install librosa soundfile && vllm serve OpenMOSS-Team/MOSS-Transcribe-Diarize --trust-remote-code"
|
| 244 |
-
```
|
| 245 |
-
|
| 246 |
-
Parse the response `text` into segments with `parse_transcript` from the model's [GitHub package](https://github.com/OpenMOSS/MOSS-Transcribe-Diarize).
|
| 247 |
-
|
| 248 |
-
**sglang-omni** (upstream's recommended production server; adds `response_format=verbose_json` with parsed speaker segments). Its prebuilt image predates this model, so install it at job start over a current [sglang nightly image](https://hub.docker.com/r/lmsysorg/sglang/tags) — the tag below is the tested pin; newer nightlies should also work. The clone + fresh-venv sequence is [upstream's documented install](https://github.com/sgl-project/sglang-omni/blob/main/docs/get_started/installation.md) and adds under a minute:
|
| 249 |
-
|
| 250 |
-
```bash
|
| 251 |
-
hf jobs run --detach --expose 8000 --flavor l4x1 -s HF_TOKEN --timeout 2h \
|
| 252 |
-
lmsysorg/sglang:nightly-dev-cu13-20260709-074bb928 -- \
|
| 253 |
-
bash -c "pip install -q uv 2>/dev/null; git clone --depth 1 https://github.com/sgl-project/sglang-omni.git && cd sglang-omni && uv venv .venv -p 3.12 && . .venv/bin/activate && uv pip install . && sgl-omni serve --model-path OpenMOSS-Team/MOSS-Transcribe-Diarize --host 0.0.0.0 --port 8000 --max-running-requests 16 --mem-fraction-static 0.80"
|
| 254 |
-
```
|
| 255 |
-
|
| 256 |
-
Query either server the same way (`response_format=verbose_json` on sglang-omni only; raise `max_new_tokens`, e.g. `65536`, for long recordings). **Caution — long audio on the serve path**: sglang-omni silently truncates input past ~62 minutes (observed deterministically at ~62.5 min on the same tape that transcribes fully via the transformers recipe, regardless of `max_new_tokens`). Split longer recordings before posting — `moss-transcribe-diarize-server.py` does this automatically:
|
| 257 |
-
|
| 258 |
-
```bash
|
| 259 |
-
curl -X POST https://<job-id>--8000.hf.jobs/v1/audio/transcriptions \
|
| 260 |
-
-H "Authorization: Bearer $HF_TOKEN" \
|
| 261 |
-
-F model=OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 262 |
-
-F file=@meeting.wav \
|
| 263 |
-
-F response_format=verbose_json \
|
| 264 |
-
-F max_new_tokens=65536
|
| 265 |
-
```
|
| 266 |
-
|
| 267 |
-
The job — and its billing — stops at `--timeout` or `hf jobs cancel <job_id>`.
|
| 268 |
|
| 269 |
## Notes
|
| 270 |
|
| 271 |
- **Gated model**: Accept terms at the [model page](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026) before use.
|
| 272 |
-
- **Tokenizer workaround**: `cohere-transcribe.py` applies a one-line patch for a tokenizer compat issue. Will be removed once upstream fixes land ([model discussion](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026/discussions/11)).
|
| 273 |
- **easytranscriber**: the Cohere backend requires `transformers>=5.4.0` (pinned in the script). Pyannote VAD is gated — accept terms at [pyannote/segmentation-3.0](https://huggingface.co/pyannote/segmentation-3.0) and [pyannote/speaker-diarization-3.1](https://huggingface.co/pyannote/speaker-diarization-3.1) if using `--vad pyannote`. Otherwise stick with the default Silero VAD.
|
| 274 |
-
- **
|
| 275 |
-
- **sglang-omni install**: the `lmsysorg/sglang-omni:dev` image predates this model — don't use it. Install from git over a current `lmsysorg/sglang` nightly image as shown above, and follow the clone + fresh-venv sequence exactly: installing outside the repo skips its `[tool.uv]` dependency overrides and fails on a protobuf conflict. Once they publish a fresh image, `sgl-omni serve` alone will do.
|
|
|
|
| 2 |
viewer: false
|
| 3 |
tags:
|
| 4 |
- uv-script
|
| 5 |
+
- hf-jobs
|
| 6 |
- audio
|
| 7 |
- transcription
|
| 8 |
- automatic-speech-recognition
|
|
|
|
| 10 |
- multilingual
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Transcription UV Scripts
|
| 14 |
|
| 15 |
+
<a href="https://huggingface.co/uv-scripts"><picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-us-on-hf-md-dark.svg"><img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-us-on-hf-md.svg" alt="Follow uv-scripts on Hugging Face"></picture></a>
|
| 16 |
+
|
| 17 |
+
> Part of [uv-scripts](https://huggingface.co/uv-scripts): self-contained UV scripts you run on Hugging Face Jobs in one command.
|
| 18 |
+
|
| 19 |
+
Scripts that transcribe audio files on a GPU with [Hugging Face Jobs](https://huggingface.co/docs/hub/jobs). Audio comes in from a [Bucket](https://huggingface.co/docs/hub/storage-buckets) or a local folder; transcripts go out as `.txt`, JSON (speaker segments or word timestamps), `.srt` or parquet.
|
| 20 |
|
| 21 |
## Quick Start
|
| 22 |
|
| 23 |
+
First, [install the `hf` CLI and sign in](https://huggingface.co/docs/hub/jobs-quickstart). Jobs needs pay-as-you-go credit. Use `hf` 1.32 or newer (`hf version`): older CLIs ignore the script's launch header without a warning, and the Job then runs on a CPU.
|
| 24 |
+
|
| 25 |
+
Transcribe four minutes of NASA's *Houston We Have a Podcast* (a host and a guest, from the [demo Bucket](https://huggingface.co/buckets/uv-scripts/transcription-demo)) with [Nemotron 3.5 Transcribe](https://huggingface.co/nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B). Replace `your-username` with your Hugging Face username:
|
| 26 |
|
| 27 |
```bash
|
| 28 |
+
hf buckets create your-username/transcripts --private
|
| 29 |
+
hf jobs uv run --timeout 45m \
|
| 30 |
+
-v hf://buckets/uv-scripts/transcription-demo/podcast:/input:ro \
|
| 31 |
+
-v hf://buckets/your-username/transcripts/podcast:/output \
|
| 32 |
+
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/nemotron-transcribe.py \
|
| 33 |
+
/input /output --timestamps
|
| 34 |
+
```
|
| 35 |
|
| 36 |
+
The Job writes a `.txt` with speaker tags and a `.json` with word timestamps to your Bucket:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
```
|
| 39 |
+
<spk:0> Jim, thank you so much for coming on the podcast today. ... <spk:3> It is, uh, the mission control room, of course, is now open for business ...
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Our test run took about 7.5 minutes on `rtx-pro-6000` (about $0.34), almost all of it model setup. Read the result with `hf buckets cp hf://buckets/your-username/transcripts/podcast/nasa-podcast-ep100.txt -`.
|
| 43 |
+
|
| 44 |
+
<details>
|
| 45 |
+
<summary>More on this example: JSON output, MOSS on the same clip, harder audio, launch headers</summary>
|
| 46 |
+
|
| 47 |
+
**JSON output.** Every word has a start and end time and a speaker (`parts[].alignment.words`), plus diarization segments (`parts[].alignment.diarization`):
|
| 48 |
+
|
| 49 |
+
```json
|
| 50 |
+
{"word": "sustainable", "start": 0.02, "end": 0.98, "speaker": "0", "part": 0}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
**MOSS on the same clip.** [MOSS-Transcribe-Diarize](https://huggingface.co/OpenMOSS-Team/MOSS-Transcribe-Diarize) on the same clip took under 2 minutes on `l4x1` (about $0.02) and wrote one line per segment (`[61.82 - 67.06] S02: The mission control room, ...`):
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
hf jobs uv run --flavor l4x1 -s HF_TOKEN --timeout 30m \
|
| 57 |
-e UV_TORCH_BACKEND=cu128 \
|
| 58 |
+
-v hf://buckets/uv-scripts/transcription-demo/podcast:/input:ro \
|
| 59 |
+
-v hf://buckets/your-username/transcripts/podcast-moss:/output \
|
| 60 |
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/moss-transcribe-diarize.py \
|
| 61 |
/input /output --emit-txt
|
| 62 |
```
|
| 63 |
|
| 64 |
+
**Harder audio.** Mount `/apollo11` instead of `/podcast`: two clips of 1969 mission tapes with radio noise and crosstalk. The [demo Bucket's README](https://huggingface.co/buckets/uv-scripts/transcription-demo) gives the sources and licences (NASA, public domain).
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
**Why no flags.** The Nemotron scripts carry a [`[tool.hf-jobs]` header](https://huggingface.co/docs/hub/jobs-configuration#define-the-launch-config-in-the-script) that sets the GPU, image and secrets. The other scripts have no header yet and take flags, as in the MOSS command. `hf jobs uv run --dry-run <script>` shows the resolved settings.
|
| 67 |
|
| 68 |
+
</details>
|
| 69 |
|
| 70 |
+
## Use your own audio
|
| 71 |
|
| 72 |
+
**Audio on your machine:** mount the folder directly. `-v ./audio:/input` syncs it to a private Bucket and mounts it in the Job; re-runs only sync changed files (`huggingface_hub` ≥ 1.22). Start with `--max-files 2`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
**Audio in a Bucket:** replace the demo input with `-v hf://buckets/your-username/your-audio:/input:ro`. The scripts walk the input folder recursively and mirror its layout in the output (easytranscriber puts its JSON under `alignments/`). `nemotron-transcribe-saturate.py` is the exception: it takes a glob (`"hf://buckets/user/audio/**/*.mp3"`) and writes parquet.
|
| 75 |
|
| 76 |
+
**Audio on the Internet Archive:** `download-ia.py` downloads an item's audio straight into a mounted Bucket:
|
| 77 |
|
| 78 |
+
```bash
|
| 79 |
+
hf jobs uv run \
|
| 80 |
+
-v hf://buckets/your-username/audio-files:/output \
|
| 81 |
+
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/download-ia.py \
|
| 82 |
+
SUSPENSE /output
|
| 83 |
+
```
|
| 84 |
|
| 85 |
+
> **Local dev**: if you've cloned this repo, swap the URL for the local filename (e.g. `cohere-transcribe.py /input /output ...`).
|
| 86 |
|
| 87 |
+
## Pick a model
|
| 88 |
|
| 89 |
+
| You need | Script | Trade-off |
|
| 90 |
+
|---|---|---|
|
| 91 |
+
| Punctuated text in one of 14 languages (en, de, fr, it, es, pt, el, nl, pl, ar, vi, zh, ja, ko) | `cohere-transcribe.py` | Gated: accept the model terms first |
|
| 92 |
+
| A lot of English audio, as fast as possible | `granite-turboctc-transcribe.py` | Lowercase, no punctuation |
|
| 93 |
+
| A language Cohere doesn't cover (102 FLEURS languages) | `buzzasr-transcribe.py` | One model per language; mostly lowercase, no punctuation |
|
| 94 |
+
| Word-level timestamps (subtitles, search, alignment) | `easytranscriber-transcribe.py` | Four-stage pipeline, slower |
|
| 95 |
+
| Who said what, in English or Chinese | `moss-transcribe-diarize.py` (`-server.py` for many files) | Slow on long files; server version needs `a100-large` |
|
| 96 |
+
| Word timestamps and speaker tags from one model, in 40 languages (speaker tags in 13) | `nemotron-transcribe.py` | ~8 min fixed setup before the first file |
|
| 97 |
+
| Nemotron text for a large batch, resumable | `nemotron-transcribe-saturate.py` | Plain text only |
|
| 98 |
|
| 99 |
+
Only the two Nemotron scripts set their own GPU and image. The others need flags, for example Cohere on an L4:
|
| 100 |
|
| 101 |
+
<details>
|
| 102 |
+
<summary>Cohere Transcribe command</summary>
|
| 103 |
|
| 104 |
+
Accept the terms on the [model page](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026) first; the model is gated.
|
| 105 |
|
| 106 |
```bash
|
| 107 |
+
hf jobs uv run --flavor l4x1 -s HF_TOKEN \
|
| 108 |
+
-e UV_TORCH_BACKEND=cu128 \
|
| 109 |
+
-v hf://buckets/your-username/audio-files:/input:ro \
|
| 110 |
+
-v hf://buckets/your-username/transcripts:/output \
|
| 111 |
+
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/cohere-transcribe.py \
|
| 112 |
+
/input /output --language en --compile
|
|
|
|
|
|
|
| 113 |
```
|
| 114 |
|
| 115 |
+
Each script's docstring has its own `hf jobs uv run` example.
|
| 116 |
+
|
| 117 |
+
</details>
|
| 118 |
|
| 119 |
+
[MODELS.md](MODELS.md) has the details for each script: speed, quality notes, pins and known issues. [BENCHMARKS.md](BENCHMARKS.md) has the measured runs.
|
| 120 |
|
| 121 |
+
## Serve as a live endpoint
|
| 122 |
+
|
| 123 |
+
Nemotron and MOSS-Transcribe-Diarize can run as a server in a Job with an [exposed port](https://huggingface.co/docs/hub/jobs-serving), so you pay the setup once and send requests from a laptop or an agent. Start one with `nemotron-transcribe.py --serve`; [SERVING.md](SERVING.md) has the commands, request examples and caveats.
|
| 124 |
+
|
| 125 |
+
## Options
|
| 126 |
+
|
| 127 |
+
The folder scripts take `/input /output` and `--max-files N` for a test run (the saturate script takes a glob and an output dataset). `--help` lists all flags.
|
| 128 |
+
|
| 129 |
+
<details>
|
| 130 |
+
<summary><code>nemotron-transcribe.py</code></summary>
|
| 131 |
|
| 132 |
| Flag | Default | Description |
|
| 133 |
|------|---------|-------------|
|
|
|
|
| 143 |
| `--request-timeout` | 3600 | Per-request timeout in seconds |
|
| 144 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 145 |
|
| 146 |
+
</details>
|
| 147 |
+
|
| 148 |
+
<details>
|
| 149 |
+
<summary><code>cohere-transcribe.py</code></summary>
|
| 150 |
|
| 151 |
| Flag | Default | Description |
|
| 152 |
|------|---------|-------------|
|
|
|
|
| 155 |
| `--batch-size` | 16 | Batch size for inference |
|
| 156 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 157 |
|
| 158 |
+
</details>
|
| 159 |
+
|
| 160 |
+
<details>
|
| 161 |
+
<summary><code>cohere-transcribe-vllm.py</code></summary>
|
| 162 |
+
|
| 163 |
+
| Flag | Default | Description |
|
| 164 |
+
|------|---------|-------------|
|
| 165 |
+
| `--language` | required | Same 14 languages as `cohere-transcribe.py` |
|
| 166 |
+
| `--gpu-memory-utilization` | 0.8 | Fraction of GPU memory vLLM may use |
|
| 167 |
+
| `--verbose` | off | More logging |
|
| 168 |
+
| `--max-files` | all | Limit files to process (for testing) |
|
| 169 |
+
|
| 170 |
+
</details>
|
| 171 |
+
|
| 172 |
+
<details>
|
| 173 |
+
<summary><code>granite-turboctc-transcribe.py</code></summary>
|
| 174 |
|
| 175 |
| Flag | Default | Description |
|
| 176 |
|------|---------|-------------|
|
|
|
|
| 179 |
| `--decode-workers` | CPU count | Threads for mp3/wav decoding, overlapped with model load and inference |
|
| 180 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 181 |
|
| 182 |
+
</details>
|
| 183 |
+
|
| 184 |
+
<details>
|
| 185 |
+
<summary><code>buzzasr-transcribe.py</code></summary>
|
| 186 |
|
| 187 |
| Flag | Default | Description |
|
| 188 |
|------|---------|-------------|
|
|
|
|
| 193 |
| `--decode-workers` | CPU count | Threads for mp3/wav decoding, overlapped with model load |
|
| 194 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 195 |
|
| 196 |
+
</details>
|
| 197 |
+
|
| 198 |
+
<details>
|
| 199 |
+
<summary><code>easytranscriber-transcribe.py</code></summary>
|
| 200 |
|
| 201 |
| Flag | Default | Description |
|
| 202 |
|------|---------|-------------|
|
| 203 |
+
| `--language` | required | ISO 639-1 code. Cohere supports the same 14 languages as `cohere-transcribe.py`; ct2/hf support any Whisper language |
|
| 204 |
| `--backend` | `cohere` | `cohere`, `ct2` (CTranslate2 Whisper, fastest for Whisper), or `hf` (transformers) |
|
| 205 |
| `--transcription-model` | Cohere 2B / distil-whisper-large-v3.5 | HF model ID; override to use KB-Whisper, Whisper-large-v3, etc. |
|
| 206 |
| `--emissions-model` | per-language default | wav2vec2 for forced alignment: en→`wav2vec2-base-960h`, sv→`voxrex-swedish`, else→`facebook/mms-1b-all` |
|
|
|
|
| 212 |
| `--batch-size-transcribe` | 16 | ASR batch size (where backend supports it) |
|
| 213 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 214 |
|
| 215 |
+
</details>
|
| 216 |
+
|
| 217 |
+
<details>
|
| 218 |
+
<summary><code>moss-transcribe-diarize-server.py</code></summary>
|
| 219 |
|
| 220 |
| Flag | Default | Description |
|
| 221 |
|------|---------|-------------|
|
|
|
|
| 226 |
| `--emit-txt` | off | Also write `.txt` transcripts |
|
| 227 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 228 |
|
| 229 |
+
</details>
|
| 230 |
+
|
| 231 |
+
<details>
|
| 232 |
+
<summary><code>moss-transcribe-diarize.py</code></summary>
|
| 233 |
|
| 234 |
| Flag | Default | Description |
|
| 235 |
|------|---------|-------------|
|
|
|
|
| 240 |
| `--emit-srt` | off | Also write `.srt` subtitles with speaker prefixes |
|
| 241 |
| `--max-files` | all | Limit files to process (for testing) |
|
| 242 |
|
| 243 |
+
</details>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
## Notes
|
| 246 |
|
| 247 |
- **Gated model**: Accept terms at the [model page](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026) before use.
|
|
|
|
| 248 |
- **easytranscriber**: the Cohere backend requires `transformers>=5.4.0` (pinned in the script). Pyannote VAD is gated — accept terms at [pyannote/segmentation-3.0](https://huggingface.co/pyannote/segmentation-3.0) and [pyannote/speaker-diarization-3.1](https://huggingface.co/pyannote/speaker-diarization-3.1) if using `--vad pyannote`. Otherwise stick with the default Silero VAD.
|
| 249 |
+
- **MOSS-Transcribe-Diarize**: not gated (Apache 2.0). Runs remote code from the model repo; see [MODELS.md](MODELS.md#notes).
|
|
|
SERVING.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Serving transcription models on Jobs
|
| 2 |
+
|
| 3 |
+
> Part of [uv-scripts/transcription](README.md).
|
| 4 |
+
|
| 5 |
+
Two models can run as a server in a Job with an [exposed port](https://huggingface.co/docs/hub/jobs-serving), so you pay the setup once and send requests from anywhere with an HF token.
|
| 6 |
+
|
| 7 |
+
## Nemotron: serve, explore, scale
|
| 8 |
+
|
| 9 |
+
Run the server on its own to pay the ~8 min setup once, then send requests with an HF token as Bearer auth:
|
| 10 |
+
|
| 11 |
+
```bash
|
| 12 |
+
# Serve: the job logs https://<job_id>--8000.hf.jobs once the model is up
|
| 13 |
+
hf jobs uv run --detach --expose 8000 --timeout 2h \
|
| 14 |
+
https://huggingface.co/datasets/uv-scripts/transcription/raw/main/nemotron-transcribe.py \
|
| 15 |
+
--serve
|
| 16 |
+
|
| 17 |
+
# Scale: the same script as a driver, from a laptop
|
| 18 |
+
uv run https://huggingface.co/datasets/uv-scripts/transcription/raw/main/nemotron-transcribe.py \
|
| 19 |
+
./audio ./transcripts --server https://<job_id>--8000.hf.jobs
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
For exploring, any OpenAI-compatible client works: `base_url="https://<job_id>--8000.hf.jobs/v1"`, `api_key=<HF token>`, with the audio as a `data:audio/flac;base64,...` `audio_url` part (see the model card). Measured from a laptop: a warm 2-minute clip came back in 2.4 s, and the driver did two half-hour episodes with `--timestamps` in 54 s. The first requests after start are slow (~1 min) while vLLM compiles two Triton kernels that its warmup misses. Cancel the job when done (`hf jobs cancel <job_id>`); exposed ports are billed on top of the hardware price, and each half-hour file is uploaded as ~30 MB, so for bulk work the in-job driver is still cheaper.
|
| 23 |
+
|
| 24 |
+
## MOSS-Transcribe-Diarize as an OpenAI-compatible API
|
| 25 |
+
|
| 26 |
+
MOSS-Transcribe-Diarize can be served as an OpenAI-compatible transcription API on Jobs (see [Serving on Jobs](https://huggingface.co/docs/hub/jobs-serving)). Two verified paths; both expose `/v1/audio/transcriptions` at `https://<job-id>--8000.hf.jobs` (requests need an HF token with read access to your namespace).
|
| 27 |
+
|
| 28 |
+
**vLLM** (simplest; returns the raw `[start][Sxx]text[end]` transcript). Model support was merged into vLLM on 2026-07-08 — after the v0.24.0 release — so use a commit-pinned nightly image until the next release (then plain `vllm/vllm-openai:latest` works). The image needs the audio extras installed first:
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
hf jobs run --detach --expose 8000 --flavor l4x1 -s HF_TOKEN --timeout 2h \
|
| 32 |
+
vllm/vllm-openai:nightly-2c17d33f4291a55b447317640c81eb61077b1b00 -- \
|
| 33 |
+
bash -c "pip install librosa soundfile && vllm serve OpenMOSS-Team/MOSS-Transcribe-Diarize --trust-remote-code"
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Parse the response `text` into segments with `parse_transcript` from the model's [GitHub package](https://github.com/OpenMOSS/MOSS-Transcribe-Diarize).
|
| 37 |
+
|
| 38 |
+
**sglang-omni** (upstream's recommended production server; adds `response_format=verbose_json` with parsed speaker segments). Its prebuilt image predates this model, so install it at job start over a current [sglang nightly image](https://hub.docker.com/r/lmsysorg/sglang/tags) — the tag below is the tested pin; newer nightlies should also work. The clone + fresh-venv sequence is [upstream's documented install](https://github.com/sgl-project/sglang-omni/blob/main/docs/get_started/installation.md) and adds under a minute:
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
hf jobs run --detach --expose 8000 --flavor l4x1 -s HF_TOKEN --timeout 2h \
|
| 42 |
+
lmsysorg/sglang:nightly-dev-cu13-20260709-074bb928 -- \
|
| 43 |
+
bash -c "pip install -q uv 2>/dev/null; git clone --depth 1 https://github.com/sgl-project/sglang-omni.git && cd sglang-omni && uv venv .venv -p 3.12 && . .venv/bin/activate && uv pip install . && sgl-omni serve --model-path OpenMOSS-Team/MOSS-Transcribe-Diarize --host 0.0.0.0 --port 8000 --max-running-requests 16 --mem-fraction-static 0.80"
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Query either server the same way (`response_format=verbose_json` on sglang-omni only; raise `max_new_tokens`, e.g. `65536`, for long recordings). **Caution — long audio on the serve path**: sglang-omni silently truncates input past ~62 minutes (observed deterministically at ~62.5 min on the same tape that transcribes fully via the transformers recipe, regardless of `max_new_tokens`). Split longer recordings before posting — `moss-transcribe-diarize-server.py` does this automatically:
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
curl -X POST https://<job-id>--8000.hf.jobs/v1/audio/transcriptions \
|
| 50 |
+
-H "Authorization: Bearer $HF_TOKEN" \
|
| 51 |
+
-F model=OpenMOSS-Team/MOSS-Transcribe-Diarize \
|
| 52 |
+
-F file=@meeting.wav \
|
| 53 |
+
-F response_format=verbose_json \
|
| 54 |
+
-F max_new_tokens=65536
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
The job — and its billing — stops at `--timeout` or `hf jobs cancel <job_id>`.
|
| 58 |
+
|
| 59 |
+
## sglang-omni install
|
| 60 |
+
|
| 61 |
+
the `lmsysorg/sglang-omni:dev` image predates this model — don't use it. Install from git over a current `lmsysorg/sglang` nightly image as shown above, and follow the clone + fresh-venv sequence exactly: installing outside the repo skips its `[tool.uv]` dependency overrides and fails on a protobuf conflict. Once they publish a fresh image, `sgl-omni serve` alone will do.
|