Repository navigation
canary: support Indic-Transcribe (Bodhan AI) output modes - #245
Open
TheAnimatrix wants to merge 1 commit into
Open
TheAnimatrix wants to merge 1 commit into
TheAnimatrix wants to merge 1 commit into
Conversation
Indic-Transcribe-Flex/Core are canary-1b-v2 fine-tunes whose prompt has a tenth slot after <|itn|>: <|romanized|>/<|noromanized|>. When a GGUF carries stt.canary.special.romanized_id/noromanized_id the canary2 prompt grows that slot, transcribe_run_params::itn selects mixed-script output (FEATURE_ITN is advertised for these models), a "<code>-Latn" language selects romanized output, and stt.canary.default_mode picks the mode used when itn is DEFAULT. Stock canary GGUFs keep the nine-slot prompt and fixed <|noitn|>. scripts/convert-indic-canary.py converts the published .nemo checkpoints without a NeMo install by rebuilding cfg, state_dict and the aggregate tokenizer from the archive and reusing convert-canary.py's convert().
This branch has not been deployed
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
Adds support for Bodhan AI's Indic-Transcribe models (Flex/Core, both canary-1b-v2 fine-tunes for 27 Indian languages) to the canary arch.
Their canary2 prompt has a tenth slot after
<|itn|>:<|romanized|>/<|noromanized|>. Without it the prompt comes out one token short and the output mode can't be picked. The model's mixed-script output (Indian words in their script, English words and digits in Latin) is selected through the<|itn|>slot, which canary currently hardwires to<|noitn|>.When a GGUF carries
stt.canary.special.romanized_id/noromanized_id:canary2_base_prompt_tokenscounts it)transcribe_run_params::itnpicks the mode: ON = mixed, OFF = native.TRANSCRIBE_FEATURE_ITNis advertised for these models only<code>-Latnlanguage (BCP-47 script subtag, e.g.te-Latn) selects romanized output. The converter lists these codes ingeneral.languagesso the dispatcher's language gate accepts them; they map to the base code's tokenstt.canary.default_mode(native|mixed|romanized) is the mode used whenitnis DEFAULTStock canary GGUFs have none of these keys, so they keep the nine-slot prompt and the fixed
<|noitn|>.scripts/convert-indic-canary.pyconverts the published.nemocheckpoints without a NeMo install. It rebuildscfg,state_dict()and the aggregate tokenizer (Bodhan'sCanaryMultilingualTokenizer:spl_tokens+ one sharedmultilingualsub-tokenizer) from the archive, then hands off toconvert-canary.py'sconvert().Scope
src/arch/canary/weights.{h,cpp}: optionalromanized_id,noromanized_id,default_modehparamssrc/arch/canary/model.cpp: prompt slot, output-mode selection,-Latnlookup, ITN feature bitscripts/convert-indic-canary.py: new converter wrapperNo changes to other families, the ABI, or the public header.
AI Assistance
Opus 5.5 high was used in assessing bugs and planning fixes.
Model files for testing
The published checkpoint is gated on Hugging Face. An ungated Q8_0 conversion made with this script is at https://huggingface.co/TheAnimatrix/indic-transcribe-flex-gguf (sha256
807af7f8…dd3282), with the license and attribution.Validation
Converted
bodhan-ai/indic-transcribe-flexnemo/indic_transcribe_flex.nemo(revecba9ba): all 1892 state-dict tensors consumed, none left over. The token table matches the checkpoint's tokenizers. F32 and Q8_0 (transcribe-quantize --quant Q8_0) both tested.On a 20 s Telugu/English code-mixed clip (Metal, M4), the output matches the model's own PyTorch reference (
indic_transcribe.py) word for word in all three modes, with the same prompt ids ([7, 4, 18, 187, 187, 5, 8|9, 10|11, 13, 15]):-l te-l te --no-itn-l te-LatnQ8_0 runs 0.75 s for 19.8 s of audio.
Regression:
canary-180m-flashQ8_0 gives an identical transcript with and without this change.Not run: the WER pipeline or numerical tensor validation against a NeMo reference dump. Happy to add tests/goldens if you want them for this variant.