Disable token timestamps for distilled models detected by config, not name#45
Open
gsdali wants to merge 1 commit into
Open
Disable token timestamps for distilled models detected by config, not name#45gsdali wants to merge 1 commit into
gsdali wants to merge 1 commit into
Conversation
… name The existing guard only disables token-level timestamps for models whose version string contains 'distil'. Some distilled models are not named 'distil-*' but still ship the original (e.g. large-v3) generation_config, whose alignment_heads reference decoder layers that no longer exist after distillation. Generating token timestamps then crashes with an IndexError in compute_alignment_heads_attention_weights. Detect this case from the config — any alignment_heads entry referencing a layer >= decoder_layers — and disable token timestamps, in addition to the existing name-based check. Repro: kotoba-tech/kotoba-whisper-bilingual-v1.0 (2 decoder layers, but ships large-v3 alignment_heads up to layer 25) fails the WhisperTextDecoder step without this.
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.
Problem
scripts/generate_model.pyonly disables token-level timestamps for models whose version string containsdistil. Some distilled models are not nameddistil-*yet still ship the original (e.g.large-v3)generation_config, whosealignment_headsreference decoder layers that no longer exist after distillation. Generating token timestamps then crashes with anIndexErrorincompute_alignment_heads_attention_weights.Repro:
whisperkit-generate-model --model-version kotoba-tech/kotoba-whisper-bilingual-v1.0— the model has 2 decoder layers but ships large-v3alignment_headsup to layer 25; the WhisperTextDecoder step fails.Fix
In addition to the existing name-based check, detect the condition from the config: if any
alignment_headsentry references a layer>= decoder_layers, disable token timestamps. Falls back gracefully (warns and continues) if the config can't be read.Evidence
This change was applied when converting
kotoba-tech/kotoba-whisper-bilingual-v1.0(whisperkittools 0.4.2, coremltools 9.0, torch 2.5.0). With it, the guard fires and the conversion completes:Without the change the same run fails at the decoder step with the IndexError above. I have not re-run the full suite against other models; the change only widens an existing disable condition and is a no-op for models without oversized
alignment_heads.🤖 Generated with Claude Code