fix(stt): support tokenizer.json for cohere-transcribe-03-2026 (mlx_audio ≤ 0.4.2 compat)#24
Open
guglxni wants to merge 1 commit intoLayr-Labs:masterfrom
Open
Conversation
|
@guglxni is attempting to deploy a commit to the EigenLabs Team on Vercel. A member of the Team first needs to authorize it. |
mlx_audio ≤ 0.4.2's post_load_hook hardcodes a SentencePiece tokenizer.model lookup, but CohereLabs/cohere-transcribe-03-2026 ships only tokenizer.json (HuggingFace fast tokenizer format). Add _CohereAsrTokenizerHF — a drop-in shim backed by `tokenizers` that implements the same interface (eos_token_id, build_prompt_tokens, batch_decode) as CohereAsrTokenizer. Monkey-patch post_load_hook in load_model() to probe for tokenizer.model first, then fall back to tokenizer.json, following the same pattern already used for load_buffers_from_checkpoint. The R2 bundle ships mlx_audio 0.2.7 (no cohere_asr at all), so this fix is only needed on installs that have upgraded to 0.4.2.
5127d22 to
05757e7
Compare
Author
|
@Gajesh2007 could you approve the workflow run for this PR? Thanks! |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mlx_audio≤ 0.4.2post_load_hookhardcodestokenizer.model(SentencePiece), butCohereLabs/cohere-transcribe-03-2026ships onlytokenizer.json(HuggingFace fast tokenizer), causing a crash at server startup._CohereAsrTokenizerHF— a drop-in shim over HuggingFacetokenizersimplementing the same interface (eos_token_id,build_prompt_tokens,batch_decode) as the existingCohereAsrTokenizer.Model.post_load_hookinsideload_model()to probetokenizer.modelfirst, then fall back totokenizer.json— same pattern already used forload_buffers_from_checkpoint.Root cause
CohereLabs/cohere-transcribe-03-2026(released March 2026) moved to the HuggingFacetokenizersJSON format;mlx_audio0.4.2 was not updated to match.Test plan
python stt_server.py --model CohereLabs/cohere-transcribe-03-2026 --port 8101starts without errorPOST /v1/audio/transcriptionsreturns a transcript for a WAV filetokenizer.model(SentencePiece) continue to load via the original pathNotes
The R2 bundle ships
mlx_audio0.2.7 (nocohere_asrmodule at all). This fix is only exercised on installs that have upgraded to 0.4.2 and are targetingcohere-transcribe-03-2026. A proper upstream fix inmlx_audiowould be preferable long-term.