Skip to content

fix(parakeet-mlx): support v2 (English) model — derive vocab/blank-id per model#9

Open
seidnerj wants to merge 2 commits into
screenpipe:mainfrom
seidnerj:fix/parakeet-mlx-v2-vocab-dims
Open

fix(parakeet-mlx): support v2 (English) model — derive vocab/blank-id per model#9
seidnerj wants to merge 2 commits into
screenpipe:mainfrom
seidnerj:fix/parakeet-mlx-v2-vocab-dims

Conversation

@seidnerj

Copy link
Copy Markdown

What

Adds support for the English-specialized mlx-community/parakeet-tdt-0.6b-v2
MLX model and fixes a crash when loading any Parakeet TDT model whose
vocabulary differs from v3.

Why

The MLX Parakeet engine hardcoded v3's vocabulary size (8192) in
VOCAB_SIZE/BLANK_ID/NUM_CLASSES. The v2 (English) model has 1024 tokens.
Because the blank id and class count were derived from the v3 constant, greedy
TDT decoding sliced the joint output's duration head at the wrong index — on v2
it produced an empty array and crashed every segment with:

[argmax] Cannot argmax reduce zero size array

Changes

  • Register parakeet-tdt-0.6b-v2mlx-community/parakeet-tdt-0.6b-v2 in
    from_pretrained and from_pretrained_cache_only.
  • Derive the per-model vocab size and blank id from the loaded joint output
    projection (out_proj.weight first dim = num_classes), instead of the v3
    default constants. The constants now only allocate the modules before
    load_weights replaces every parameter with the model's own tensor.
  • Guard with a clear error if the joint projection has too few classes for the
    duration table + blank.
  • Add examples/verify_v2_mlx.rs to verify v2 loads and transcribes on GPU.

Testing

Verified parakeet-tdt-0.6b-v2 loads and transcribes correctly on Metal GPU
with zero decode errors; the v3 path is unchanged.

seidnerj added 2 commits June 12, 2026 13:05
…ing v3

The MLX engine hardcoded the v3 (multilingual) vocabulary size (8192) for the
blank id and the joint-output split. Loading the v2 (English, 1024-vocab)
model produces a 1030-class joint output, but greedy TDT decode still sliced
the duration head at index 8193 — an empty array — so argmax failed with
"Cannot argmax reduce zero size array" on every segment, speech or silence.

Derive num_classes from the loaded joint output projection and compute
blank_id = num_classes - durations - 1 (= vocab_size) per model. Works for
both v2 (->1024) and v3 (->8192).

Verified end-to-end (examples/verify_v2_mlx.rs): parakeet-tdt-0.6b-v2-mlx now
transcribes English speech correctly on GPU and returns empty without crashing
on silence and sub-frame input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant