espnet3.systems.esp2_st.src.backend.Speech2TextShortSafe
espnet3.systems.esp2_st.src.backend.Speech2TextShortSafe
class espnet3.systems.esp2_st.src.backend.Speech2TextShortSafe(st_train_config: Path | str | None = None, st_model_file: Path | str | None = None, transducer_conf: dict | None = None, lm_train_config: Path | str | None = None, lm_file: Path | str | None = None, ngram_scorer: str = 'full', ngram_file: Path | str | None = None, token_type: str | None = None, bpemodel: str | None = None, src_lm_train_config: Path | str | None = None, src_lm_file: Path | str | None = None, src_ngram_scorer: str = 'full', src_ngram_file: Path | str | None = None, src_token_type: str | None = None, src_bpemodel: str | None = None, device: str = 'cpu', maxlenratio: float = 0.0, minlenratio: float = 0.0, asr_maxlenratio: float = 0.0, asr_minlenratio: float = 0.0, batch_size: int = 1, dtype: str = 'float32', beam_size: int = 20, ctc_weight: float = 0.0, lm_weight: float = 1.0, ngram_weight: float = 0.9, penalty: float = 0.0, nbest: int = 1, normalize_length: bool = False, asr_beam_size: int = 20, asr_lm_weight: float = 1.0, asr_ngram_weight: float = 0.9, asr_penalty: float = 0.0, asr_ctc_weight: float = 0.3, asr_nbest: int = 1, enh_s2t_task: bool = False, ctc_greedy: bool = False, hugging_face_decoder: bool = False, hugging_face_decoder_max_length: int = 256)
Bases: Speech2Text
Speech2Text that survives utterances too short to subsample.
egs2 does not apply the 0.1-20 s filter to test sets (st.sh: “NOT applying to test_sets to keep original data”), so tst-COMMON contains 54 of 2,641 utterances below the frames a conv2d-subsampling conformer needs – the shortest is 0.050 s. Decoding one raises TooShortUttError.
espnet2 handles this in its CLI loop (espnet2/bin/st_inference.py), not inside Speech2Text.__call__, which is what the infer stage reaches through the runner. One such utterance would otherwise abort the whole test set.
The fallback mirrors egs2: emit TOO_SHORT_TEXT and keep the utterance, so its reference is still scored as a miss rather than dropped – dropping would inflate BLEU by taking the hardest items out of the denominator.
It lives in the backend rather than in the runner because format_output runs after the model call, and so cannot catch an exception raised during it.
