yunqi1766's picture
Add Meta OmniASR Modal baseline (part 2)
2f94fe0 verified
|
Raw
History Blame Contribute Delete
13.4 kB
# Running Modal ASR Baselines
BES-4805 evaluates NVIDIA Parakeet TDT 0.6B v3 as the batch baseline
`modal_nvidia_parakeet_tdt_0_6b_v3`. The checked-in deployment source is
`modal/parakeet_tdt_0_6b_v3.py`; do not use owner-private deployment code or
the old non-ticket model ID.
## Deployment Constants
- Benchmark model ID: `modal_nvidia_parakeet_tdt_0_6b_v3`
- Upstream model: `nvidia/parakeet-tdt-0.6b-v3`
- Upstream revision: `b51b7dc0fbf7f266a97880fb4b626c56d28f4b96`
- Modal app: `voice-code-bench-parakeet`
- Modal GPU: `L40S`
- Modal Volume: `voice-code-bench-parakeet-hf-cache`
- Runtime: Transformers `5.12.0`
- Endpoint secret: `MODAL_PARAKEET_ENDPOINT`
The app stores official Hugging Face weights in the Modal Volume at `/models`
and loads them once per warm container with `@modal.enter`. The benchmark sends
one complete 16 kHz mono WAV per request. There is no chunking, no prompts, no
custom vocabulary, and no post-ASR correction.
The Meta OmniASR section below covers BES-4806. Inworld STT is not part of these Modal deployment paths.
## Modal Credentials
Install and configure the Modal CLI/API credentials for the workspace that will
own the deployment:
```bash
python -m pip install modal==1.4.1
modal setup
```
Create a Modal proxy token for the environment that will serve the Web Function:
```bash
modal workspace proxy-tokens create
```
If your workspace uses scoped proxy tokens, allow the token in the deployment
environment. Store the endpoint and proxy token in the ignored `scripts/.secret`
file:
```dotenv
MODAL_PARAKEET_ENDPOINT=https://<your-parakeet-web-function>.modal.run
MODAL_PROXY_TOKEN_ID=wk-...
MODAL_PROXY_TOKEN_SECRET=ws-...
```
The entity-verification stage of `vcb-run` also needs `OPENAI_API_KEY=...`.
Never commit `scripts/.secret`.
## Warm The Model Cache
Run the cache warm-up before deployment:
```bash
modal run modal/parakeet_tdt_0_6b_v3.py::download_model
```
Verify in Modal logs that the download used
`nvidia/parakeet-tdt-0.6b-v3` at
`b51b7dc0fbf7f266a97880fb4b626c56d28f4b96` and wrote under
`/models/nvidia/parakeet-tdt-0.6b-v3`. The revision literal in
`modal/parakeet_tdt_0_6b_v3.py`, the volume directory, and the Hugging Face
revision should match before releasing results.
## Deploy
Deploy the Web Function:
```bash
modal deploy modal/parakeet_tdt_0_6b_v3.py
```
Copy the authenticated Web Function URL printed by Modal, or find it in the
Modal dashboard for `voice-code-bench-parakeet`, and save it as
`MODAL_PARAKEET_ENDPOINT`. The benchmark adapter accepts the exact Web Function
URL and normalizes trailing slashes.
The endpoint accepts JSON only:
```json
{
"audio_base64": "<base64-encoded 16 kHz mono WAV bytes>",
"audio_format": "wav"
}
```
It also accepts optional `"language": "en"` for manual compatibility checks,
but the registered benchmark configuration does not send a language hint. The
response body is exactly:
```json
{
"transcript": "<verbatim model output>"
}
```
Requests must include the proxy-token headers:
```text
Modal-Key: <MODAL_PROXY_TOKEN_ID>
Modal-Secret: <MODAL_PROXY_TOKEN_SECRET>
```
The benchmark stores only the returned transcript verbatim.
## Longest-Recording Smoke Test
Create a one-row metadata file for the longest recording,
`audio_id=education_workplace_006` (`data/audio/261.wav`, 122.875 seconds):
```bash
mkdir -p runs/parakeet-longest-smoke
python - <<'PY'
import json
from pathlib import Path
source = Path('data/metadata.jsonl')
out = Path('runs/parakeet-longest-smoke/metadata.longest.jsonl')
for line in source.read_text().splitlines():
row = json.loads(line)
if row['audio_id'] == 'education_workplace_006':
out.write_text(json.dumps(row, separators=(',', ':')) + '\n')
break
else:
raise SystemExit('education_workplace_006 not found')
PY
```
Run the smoke transcription without using `--limit 1`:
```bash
vcb-transcribe \
--metadata runs/parakeet-longest-smoke/metadata.longest.jsonl \
--stt-model-ids modal_nvidia_parakeet_tdt_0_6b_v3 \
--output-dir runs/parakeet-longest-smoke
```
Inspect `runs/parakeet-longest-smoke/modal_nvidia_parakeet_tdt_0_6b_v3/transcripts.json`
and confirm it has one non-empty `model_transcript` for
`education_workplace_006`. Modal logs should show one complete request for the
122.875-second WAV and no client-side chunking.
## Full Run
With `MODAL_PARAKEET_ENDPOINT`, `MODAL_PROXY_TOKEN_ID`,
`MODAL_PROXY_TOKEN_SECRET`, and `OPENAI_API_KEY` configured, run:
```bash
vcb-run \
--stt-model-ids modal_nvidia_parakeet_tdt_0_6b_v3 \
--resume \
--output-dir runs/parakeet-full
```
If interrupted, rerun the same command with `--resume`. After the run completes,
validate that transcripts and entity matches cover all 300 audio IDs in
`data/metadata.jsonl` order, then copy the generated entity-match artifact to
`baselines/predictions/modal_nvidia_parakeet_tdt_0_6b_v3.json` without editing
transcripts, entity decisions, or run metadata by hand.
Regenerate current aggregate outputs after the prediction artifact exists:
```bash
vcb-score-entities \
--dataset-root . \
--metadata data/metadata.jsonl \
--entity-matches-dir baselines/predictions \
--output-dir baselines \
--scores-dir baselines/scores/entities \
--output-csv baselines/results.csv
vcb-score-wer \
--dataset-root . \
--metadata data/metadata.jsonl \
--transcripts-dir baselines/predictions \
--output-dir baselines \
--scores-dir baselines/scores/wer \
--output-csv baselines/results.csv
vcb-make-figures --model-set all
```
`./scripts/reproduce_release.sh` remains the frozen paper reproduction path and
must not require Modal credentials.
## Meta OmniASR LLM Unlimited 7B v2
BES-4806 evaluates Meta OmniASR Unlimited 7B v2 as the batch model ID
`modal_meta_omniasr_llm_unlimited_7b_v2`. The checked-in deployment source is
`modal/omniasr_llm_unlimited_7b_v2.py`; do not use the standard 40-second
OmniASR models, the public Replicate endpoint, private deployment code, or a
client-side chunking wrapper.
### OmniASR Deployment Constants
- Benchmark model ID: `modal_meta_omniasr_llm_unlimited_7b_v2`
- Upstream model card: `omniASR_LLM_Unlimited_7B_v2`
- Runtime and catalog revision: `omnilingual-asr==0.2.0`
- Modal app: `voice-code-bench-omniasr`
- Modal GPU: `L40S`
- Modal Volume: `voice-code-bench-omniasr-fairseq2-cache`
- Fairseq2 asset cache: `/root/.cache/fairseq2/assets`
- Language conditioning: `eng_Latn`
- Endpoint secret: `MODAL_OMNIASR_ENDPOINT`
The app mounts the persistent fairseq2 asset cache Volume at
`/root/.cache/fairseq2/assets`, warms the official assets before deployment, and
constructs `ASRInferencePipeline(model_card="omniASR_LLM_Unlimited_7B_v2")` once
per warm container with `@modal.enter`. Each benchmark request sends one
complete 16 kHz mono WAV. There is no client-side chunking, server-side
chunking, prompt, target entity list, custom vocabulary, canonicalization, or
post-ASR correction.
Live OmniASR deployment and release are blocked until the runner has a usable
Modal deployment credential, a deployed Web Function URL, `MODAL_PROXY_TOKEN_ID`,
`MODAL_PROXY_TOKEN_SECRET`, and either a live entity-verifier credential or a
complete verifier cache accepted by `vcb-run`. Mock output is never releasable.
### OmniASR Credentials
Install and configure Modal for the workspace that will own the app:
```bash
python -m pip install modal==1.4.1
modal setup
```
Create a Modal proxy token for the deployment environment:
```bash
modal workspace proxy-tokens create
```
Store only private values in ignored `scripts/.secret` or equivalent environment
variables:
```dotenv
MODAL_OMNIASR_ENDPOINT=https://<your-omniasr-web-function>.modal.run
MODAL_PROXY_TOKEN_ID=wk-...
MODAL_PROXY_TOKEN_SECRET=ws-...
OPENAI_API_KEY=...
```
Never commit `scripts/.secret` or proxy token values.
### Warm The OmniASR Cache
Run cache warm-up before deployment:
```bash
modal run modal/omniasr_llm_unlimited_7b_v2.py::warm_model_cache
```
Verify Modal logs show `omniASR_LLM_Unlimited_7B_v2`,
`omnilingual-asr==0.2.0`, and `/root/.cache/fairseq2/assets`. Rerun the warm-up
if it is interrupted; a successful rerun should reuse the persistent Volume
instead of downloading the full asset set again. If serving reports a missing
asset cache, rerun only this warm-up path before redeploying.
### Deploy OmniASR
Deploy the authenticated Web Function:
```bash
modal deploy modal/omniasr_llm_unlimited_7b_v2.py
```
Copy the Web Function URL printed by Modal, or find it in the dashboard for
`voice-code-bench-omniasr`, and save it as `MODAL_OMNIASR_ENDPOINT`. The
benchmark adapter accepts the URL and normalizes trailing slashes.
The endpoint accepts JSON only:
```json
{
"audio_base64": "<base64-encoded 16 kHz mono WAV bytes>",
"audio_format": "wav",
"language": "eng_Latn"
}
```
The response body is exactly:
```json
{
"transcript": "<verbatim model output>"
}
```
Requests must include the proxy-token headers:
```text
Modal-Key: <MODAL_PROXY_TOKEN_ID>
Modal-Secret: <MODAL_PROXY_TOKEN_SECRET>
```
A request without those headers should be rejected before inference. Endpoint
errors must not include proxy token values.
### OmniASR Longest-Recording Smoke Test
Create a one-row metadata file for the longest recording,
`audio_id=education_workplace_006` (`data/audio/261.wav`, 122.875 seconds). Do
not use `--limit 1`, because that selects the first metadata row rather than the
longest recording.
```bash
mkdir -p runs/omniasr-longest-smoke
python - <<'PY'
import json
from pathlib import Path
source = Path('data/metadata.jsonl')
out = Path('runs/omniasr-longest-smoke/metadata.longest.jsonl')
for line in source.read_text().splitlines():
row = json.loads(line)
if row['audio_id'] == 'education_workplace_006':
out.write_text(json.dumps(row, separators=(',', ':')) + '\n')
break
else:
raise SystemExit('education_workplace_006 not found')
PY
```
Run the smoke transcription:
```bash
vcb-transcribe \
--metadata runs/omniasr-longest-smoke/metadata.longest.jsonl \
--stt-model-ids modal_meta_omniasr_llm_unlimited_7b_v2 \
--output-dir runs/omniasr-longest-smoke
```
Inspect
`runs/omniasr-longest-smoke/modal_meta_omniasr_llm_unlimited_7b_v2/transcripts.json`
and Modal logs. Confirm exactly one non-empty `model_transcript` for
`education_workplace_006`, one complete 122.875-second request, language
`eng_Latn`, batch size 1, and no client-side chunking. Send a second
authenticated smoke request while the container is warm and confirm logs do not
show another pipeline construction for the same warm container.
### OmniASR Full Run And Release Artifact
After the longest-recording smoke test succeeds, run all 300 recordings with
resume enabled from the first invocation:
```bash
vcb-run \
--stt-model-ids modal_meta_omniasr_llm_unlimited_7b_v2 \
--resume \
--output-dir runs/omniasr-full
```
If interrupted, rerun the identical command with `--resume`. Do not regenerate
completed rows. Do not score or release mock transcripts.
Before copying anything to `baselines/predictions/`, validate the final artifact
against `data/metadata.jsonl`: exactly 300 rows, exactly 300 unique `audio_id`
values, identical order, one non-empty `model_transcript` for every row, entity
matches for every target entity, and run metadata containing provider `modal`,
model `omniASR_LLM_Unlimited_7B_v2`, revision `omnilingual-asr==0.2.0`,
`language="eng_Latn"`, the real normalized endpoint, evaluation date, mode
`batch`, L40S, batch size 1, timeout 600 seconds, and 10 max attempts.
Only after that validation passes, copy the generated entity-match artifact to:
```text
baselines/predictions/modal_meta_omniasr_llm_unlimited_7b_v2.json
```
Do not hand-edit transcripts, entity decisions, or run metadata.
Regenerate current aggregate outputs after the real prediction artifact exists:
```bash
vcb-score-entities \
--dataset-root . \
--metadata data/metadata.jsonl \
--entity-matches-dir baselines/predictions \
--output-dir baselines \
--scores-dir baselines/scores/entities \
--output-csv baselines/results.csv
vcb-score-wer \
--dataset-root . \
--metadata data/metadata.jsonl \
--transcripts-dir baselines/predictions \
--output-dir baselines \
--scores-dir baselines/scores/wer \
--output-csv baselines/results.csv
vcb-make-figures --model-set all
```
Update README counts, ranges, and exact OmniASR WER/CTEM/TSR only from the
computed `baselines/results.csv` row. `./scripts/reproduce_release.sh` remains
the frozen paper reproduction path and must not require Modal credentials or add
OmniASR to `PAPER_MODEL_IDS`.
### OmniASR Cleanup
Stop the app when no more requests are expected:
```bash
modal app stop voice-code-bench-omniasr
```
Retain `voice-code-bench-omniasr-fairseq2-cache` while the released baseline may
need reruns. Delete the Volume only when you intentionally want to remove the
cached official assets and are ready to rerun `warm_model_cache`.
## Teardown
After release, stop the app if no more requests are expected:
```bash
modal app stop voice-code-bench-parakeet
```
Retain the `voice-code-bench-parakeet-hf-cache` volume while the released
baseline may need reruns. Delete the volume only when you intentionally want to
remove the cached official weights and are ready to rerun the warm-up step.