mstar.model.omnilingual_asr.tokenizer#
The Omnilingual ASR character vocabulary and CTC decoding.
The tokenizer is a SentencePiece model whose pieces are single characters
(the space is a literal ' ' piece, not ▁), plus <s>, <pad>,
</s> (control) and <unk>. The reference decodes with fairseq2’s
SentencePiece decoder, which concatenates pieces, renders control pieces as
nothing and <unk> as `` ⁇ , and adds or strips no whitespace. So a
lookup table reproduces it, and the ``.model file is read here directly
(its protobuf wire format, pieces and types only) rather than through the
sentencepiece package.
CTC decoding is the reference’s _apply_model_wav2vec2asr: argmax per
frame, drop each frame equal to the one before it, then decode, which drops
the blank (a control piece) along with the other specials.
Functions
|
Keep the first frame and every frame that differs from the one before it (the blank is dropped later, at decode). |
|
Collapsed argmax ids over a request's |
|
Classes
|
id -> text for a single-character SentencePiece vocabulary. |
- class mstar.model.omnilingual_asr.tokenizer.CharTokenizer(pieces)[source]#
Bases:
objectid -> text for a single-character SentencePiece vocabulary.
- mstar.model.omnilingual_asr.tokenizer.ctc_collapse(ids)[source]#
Keep the first frame and every frame that differs from the one before it (the blank is dropped later, at decode).