1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// arch/granite5_ctc/decoder.h - CTC greedy decode and result assembly.
//
// There is no neural decoder in this family. `GraniteSpeech5ForCTC` is
// one tied linear over the encoder output; "decoding" is argmax per
// frame followed by the standard CTC collapse.
//
// Reference for the collapse is NOT the modeling file — `generate()`
// only does `logits.argmax(-1)` and leaves the frame sequence intact.
// The collapse lives in the tokenizer the checkpoint declares,
// `ParakeetTokenizer._decode` (tokenization_parakeet.py):
//
// token_ids = [g[0] for g in itertools.groupby(token_ids)]
// token_ids = [t for t in token_ids if t != self.pad_token_id]
//
// i.e. run-length collapse FIRST, then drop blanks, so a blank between
// two identical labels correctly preserves both. `tokenizer_class` in
// tokenizer_config.json is load-bearing, not cosmetic: decoding with a
// plain byte-level BPE tokenizer emits every repeated frame.
namespace transcribe
;
namespace transcribe::granite5_ctc // namespace transcribe::granite5_ctc