Repository navigation
Add CTC word timestamps to Granite Speech 5.0 TurboCTC - #903
Conversation
Word spans and greedy-class confidence now follow the encoder clock, while the transcript text stays the same. Co-authored-by: Cursor <[email protected]>
…reaming runs Word ends are limited to the clip they came from, so fixed and VAD chunks cannot produce words that run into the next chunk. The golden test now also checks a fixed-chunk run and a streaming run, and takes --backend and --chunk-seconds. Co-authored-by: Cursor <[email protected]>
|
@bradmurray-dt Thanks for adding this missing path! One minor issue to fix then the PR is ready to merge. The frontend resamples to 16 kHz, but the timestamps combine that clock with offsets and buffer lengths from the original sample rate. Test input: librispeech_test_clean_6930-75918-0000.wav --- “Concord returned to its place amidst the tents.”
|
The frontend resamples to 16 kHz, so CTC frame positions are converted to the input buffer's sample rate before chunk offsets and the chunk-end clamp are applied. The golden test now checks 48 kHz and 8 kHz input against the 16 kHz word times. Co-authored-by: Cursor <[email protected]>
|
Thanks for catching this. Fixed in 3ebf477. The frontend resamples each clip to 16 kHz, so CTC frame positions are on the 16 kHz clock. Each frame position is now converted to the input buffer's sample rate before the chunk offset and the chunk-end clamp are applied, following the rescale pattern in 622cadd. Nothing new is resampled and no rates are rejected; only the reported indexes change. Same clip, offline,
|
|
@bradmurray-dt Thanks and PR merged! A follow-up PR addressing the timestamp inconsistency between streaming and offline would be appreciated. Currently, offline timestamps use the input sample rate, while streaming timestamps always use 16 kHz. |
Summary
word_timestampsfor offlinerunand streamingfinish_stream.supports_timestampsis true in the loader, inspect path, andload_granite5asr_model, and the model spec advertisesword_timestamps.confidenceis the geometric mean of the greedy-class probability on the non-blank frames of that word.Test plan
Machine: Apple M4 Pro, macOS. Model:
ibm-granite/granite-speech-5.0-470m-turboctc(safetensors snapshot, package idgranite5asr_safetensors). Audio:assets/asr_validation/librispeech/librispeech_test_clean_6930-75918-0000.wav(16 kHz mono, 56080 samples).The golden test runs offline, offline with 1 s fixed chunks (
--chunk-seconds, default 1), and streaming in 512-sample chunks. For each run it checks that words are non-empty, do not overlap, stay inside the buffer, and join to the normalized transcript. The offline and streaming transcripts must also match the expected text.Results, identical on
--backend cpuand--backend metal:concord0–14080tents44800–46080concord0–12800s48000–49280concord0–14080tents44800–46080granite5asr_ctc_timestamps_testandmodel_spec_system_testpassed.test_granite5asr_golden_transcriptionexits 125.Limits