Skip to content
How-to GuideUnreviewed

Run phone recognition inference and alignment

Sample dry vocal recordings, run text-free phone recognition models, calibrate SPAM on singing voice, and inspect or edit phoneme boundaries on the Dashboard. Before starting, verify that your datasets or local .wav files are available on disk and that infra/runtime/local.toml points to your local data_root.

1. Prepare a sample bundle

Sample dry vocal utterances and extract their ground-truth (GT) phone intervals into a new bundle directory. Without --root, the CLI reads the corpus from data_root in the runtime config:

uv run --project research/phone-recognition phone-recognition prepare \
  --dataset opencpop \
  --runtime infra/runtime/local.toml \
  --output local/data/phone-recognition/opencpop \
  --count 25 \
  --seed 42 \
  --split train

The following table lists each supported dataset, its default path under data_root, and its official splits.

Dataset Default root --split
Opencpop datasets/opencpop train, test, or all
GTSinger datasets/gtsinger all
M4Singer datasets/m4singer all

Ingest manual audio without GT

Package custom recordings without ground-truth labels into a new bundle:

uv run --project research/phone-recognition phone-recognition ingest \
  local/data/recordings/sample.wav \
  --output local/data/phone-recognition/custom \
  --language zh \
  --title "My Recording"

Pass --model and --publish to run inference and upload the bundle to the Dashboard in the same command:

uv run --project research/phone-recognition phone-recognition ingest \
  local/data/recordings/sample.wav \
  --output local/data/phone-recognition/custom \
  --language zh \
  --model phonsa \
  --checkpoint local/assets/phonsa/Chinese_pretrained_model_Phonsa \
  --runtime infra/runtime/local.toml \
  --publish

2. Run model inference

Each inference run adds or replaces one track by track ID in the same manifest, so you can compare multiple models, decoding modes, and vocabularies on one Dashboard page.

SPAM

Create an isolated Python 3.12 virtual environment for phonespam:

uv venv local/third_party/phonespam-env --python 3.12

Install phonespam into that environment:

uv pip install --python local/third_party/phonespam-env phonespam

Run SPAM inference against the bundle manifest:

uv run --project research/phone-recognition phone-recognition infer \
  local/data/phone-recognition/opencpop/manifest.json \
  --model spam \
  --runtime infra/runtime/local.toml \
  --python local/third_party/phonespam-env/bin/python \
  --checkpoint juice500/wavlm-24-phonemodel

By default, SPAM outputs unrestricted IPA phones. Pass --vocabulary cmn alongside --track-id spam-cmn to constrain decoding to the PHOIBLE Mandarin inventory.

The following table describes the decoding paths selected by --spam-mode.

Mode Behavior Default track ID
full (default) SPAM segmenter finds boundaries and the recognition head labels each segment spam
recognition Recognition head labels every encoder frame, merges adjacent identical labels, and uses no segmenter spam-recognition

Phonsa

You do not need to activate the Phonsa virtual environment in your shell because the CLI invokes its interpreter directly.

Clone Phonsa into local/third_party/phonsa:

git clone https://github.com/YatingMusic/Phonsa local/third_party/phonsa

Create its Python 3.10 virtual environment:

uv venv local/third_party/phonsa/.venv --python 3.10

Install its requirements along with openai-whisper:

uv pip install --python local/third_party/phonsa/.venv -r local/third_party/phonsa/requirements.txt openai-whisper

Download the pretrained weights and configuration from Hugging Face (Lonian/Phonsa) or Google Drive, then extract them into local/assets/phonsa. Confirm that both best_model.pt and config.yaml are present in the model directory (for example, local/assets/phonsa/Chinese_pretrained_model_Phonsa/best_model.pt and local/assets/phonsa/Chinese_pretrained_model_Phonsa/config.yaml).

Run Phonsa inference by pointing --checkpoint to the model directory:

uv run --project research/phone-recognition phone-recognition infer \
  local/data/phone-recognition/opencpop/manifest.json \
  --model phonsa \
  --runtime infra/runtime/local.toml \
  --checkpoint local/assets/phonsa/Chinese_pretrained_model_Phonsa

3. Calibrate SPAM on singing voice

Original SPAM fits articulatory feature directions from raw mean differences on TIMIT speech. Regularized calibration (whitened_lda, ridge_logistic, or mean_diff) adapts those projections to annotated singing voice corpora across SSL backbones. Calibration uses only independently labeled single segments and silence, excluding compound finals and breaths.

Calibrate a SPAM checkpoint using WavLM-Large on Opencpop:

uv run --project research/phone-recognition phone-recognition calibrate \
  --dataset opencpop \
  --output local/assets/spam/spam-opencpop-lda.pt \
  --backbone microsoft/wavlm-large \
  --method whitened_lda \
  --count 50

To calibrate with a multilingual SSL backbone such as MMS, pass --backbone facebook/mms-300m:

uv run --project research/phone-recognition phone-recognition calibrate \
  --dataset opencpop \
  --output local/assets/spam/spam-mms-lda.pt \
  --backbone facebook/mms-300m \
  --method whitened_lda \
  --count 50

Run inference on any bundle by passing the calibrated .pt file to --checkpoint:

uv run --project research/phone-recognition phone-recognition infer \
  local/data/phone-recognition/opencpop/manifest.json \
  --model spam \
  --checkpoint local/assets/spam/spam-opencpop-lda.pt \
  --track-id spam-calib-lda \
  --runtime infra/runtime/local.toml

4. Manage bundle tracks

Use the track subcommands to inspect, filter, or relabel prediction tracks in a bundle manifest.

List all tracks and average segment counts in a bundle:

uv run --project research/phone-recognition phone-recognition track list \
  local/data/phone-recognition/opencpop/manifest.json

Drop unwanted prediction tracks from the bundle:

uv run --project research/phone-recognition phone-recognition track drop \
  local/data/phone-recognition/opencpop/manifest.json \
  "spam-calib-50" "spam-recognition"

Keep only the specified tracks (gt is always preserved):

uv run --project research/phone-recognition phone-recognition track keep \
  local/data/phone-recognition/opencpop/manifest.json \
  phonsa "SPAM LDA 50"

Rename a track ID and set its Dashboard display label:

uv run --project research/phone-recognition phone-recognition track rename \
  local/data/phone-recognition/opencpop/manifest.json \
  "SPAM LDA 50" "spam-lda-50" \
  --label "SPAM (Whitened LDA)"

Update only the display label of an existing track:

uv run --project research/phone-recognition phone-recognition track set-label \
  local/data/phone-recognition/opencpop/manifest.json \
  "spam-lda-50" "SPAM (Whitened LDA)"

Update the bundle title shown on the Dashboard:

uv run --project research/phone-recognition phone-recognition track retitle \
  local/data/phone-recognition/opencpop/manifest.json \
  "Opencpop 25: Phonsa vs SPAM"

Append --publish to any track command to re-upload the updated bundle to the Dashboard immediately:

uv run --project research/phone-recognition phone-recognition track drop \
  local/data/phone-recognition/opencpop/manifest.json \
  "spam-recognition" \
  --publish

5. Publish and synchronize with the dashboard

Collections receive numeric IDs on the Dashboard (for example, /alignments/1). You can publish an initial bundle, push new prediction tracks without overwriting human-annotated ground truth, or pull verified collections down to disk for calibration.

Publish an initial corpus bundle to the Dashboard:

uv run --project research/phone-recognition phone-recognition publish \
  local/data/phone-recognition/opencpop/manifest.json \
  --runtime infra/runtime/local.toml

Run inference and push the resulting prediction track directly to an existing collection without overwriting GT:

uv run --project research/phone-recognition phone-recognition infer \
  local/data/phone-recognition/opencpop/manifest.json \
  --model spam \
  --checkpoint local/assets/spam/spam-mms-lda-50.pt \
  --track-id spam-mms-lda-50 \
  --push-track 1 \
  --runtime infra/runtime/local.toml

Push an existing prediction track from a local manifest to a Dashboard collection:

uv run --project research/phone-recognition phone-recognition track push \
  local/data/phone-recognition/opencpop/manifest.json \
  --collection 1 \
  --track-id spam-mms-lda-50 \
  --label "SPAM MMS (LDA 50)" \
  --runtime infra/runtime/local.toml

Download an entire collection, including verified GT and audio, to local disk:

uv run --project research/phone-recognition phone-recognition pull 1 \
  --output local/data/phone-recognition/downloaded-1 \
  --runtime infra/runtime/local.toml

Calibrate SPAM directly on verified human annotations from a Dashboard collection:

uv run --project research/phone-recognition phone-recognition calibrate \
  --dataset 1 \
  --output local/assets/spam/spam-human-calibrated.pt \
  --method whitened_lda \
  --runtime infra/runtime/local.toml

6. Annotate GT on the dashboard

Use the keyboard controls on the Dashboard alignment page to review and refine ground-truth intervals:

  • Audition: Press Tab to audition the selected phoneme, or press Shift + Tab to audition with 150 ms of surrounding context. Press L to toggle loop playback.
  • Boundary adjustment: Press [ or ] to shift the start boundary by 5 ms, or press Alt + [ or Alt + ] to shift it by 1 ms. Press { or } to shift the end boundary. Boundaries remain contiguous with adjacent intervals.
  • Segmentation: Press Left or Right to select adjacent intervals, press S to split at the playhead, and press Delete or Backspace to merge adjacent intervals. Double-click an interval to edit its label.
  • Special tokens: Insert SP for silence or AP for breath. Select Adopt Prediction to align the GT boundary to the matching model prediction.
  • Save and verification: Press Cmd + Enter to save edits, mark the utterance as verified, and move to the next sample.

Type to search…

↑↓ navigate↵ selectEsc close