espnet.nets.beam_search_timesync_streaming.BeamSearchTimeSyncStreaming
espnet.nets.beam_search_timesync_streaming.BeamSearchTimeSyncStreaming
class espnet.nets.beam_search_timesync_streaming.BeamSearchTimeSyncStreaming(sos: int, beam_size: int, scorers: ~typing.Dict[str, ~espnet.nets.scorer_interface.ScorerInterface], weights: ~typing.Dict[str, float], token_list=<class 'dict'>, pre_beam_ratio: float = 1.5, blank: int = 0, hold_n: int = 0)
Bases: Module
Time synchronous beam search algorithm.
Initialize beam search.
- Parameters:
- beam_size – num hyps
- sos – sos index
- ctc – CTC module
- pre_beam_ratio – pre_beam_ratio * beam_size = pre_beam pre_beam is used to select candidates from vocab to extend hypotheses
- decoder – decoder ScorerInterface
- ctc_weight – ctc_weight
- blank – blank index
cached_score(h: Tuple[int], cache: dict, scorer: ScorerInterface, recompute_cache: bool = False) → Any
Retrieve decoder/LM scores which may be cached.
forward(x: Tensor, maxlenratio: float = 0.0, minlenratio: float = 0.0, start_idx: int = 0, is_final: bool = False, incremental_decode: bool = False) → List[Hypothesis]
Perform beam search.
- Parameters:enc_output (torch.Tensor)
- Returns: list[Hypothesis]
joint_score(hyps: Any, ctc_score_dp: Any, recompute_cache: bool = False) → Any
Calculate joint score for hyps.
reset(enc_output: Tensor)
Reset object for a new utterance.
time_step(p_ctc: Any, ctc_score_dp: Any, hyps: Any, recompute_cache: bool = False) → Any
Execute a single time step.