espnet2.asr.transducer.beam_search_transducer_streaming.Hypothesis
espnet2.asr.transducer.beam_search_transducer_streaming.Hypothesis
class espnet2.asr.transducer.beam_search_transducer_streaming.Hypothesis(score: float, yseq: List[int], dec_state: Tuple[Tensor, Tensor | None] | List[Tensor | None] | Tensor, lm_state: Dict[str, Any] | List[Any] | None = None)
Bases: object
Default hypothesis definition for Transducer search algorithms.
This class represents a single hypothesis in the context of Transducer models during beam search decoding. It includes the score of the hypothesis, the sequence of tokens generated so far, and the state information for both the decoder and language model.
score
The score of the hypothesis, which is a cumulative measure of its likelihood.
- Type: float
yseq
A list of integers representing the generated token sequence.
- Type: List[int]
dec_state (Union[Tuple[torch.Tensor, Optional[torch.Tensor]],
List[Optional[torch.Tensor]], torch.Tensor]): The state of the decoder, which may vary depending on the decoder’s architecture.
lm_state
The state of the language model, if applicable. Defaults to None.
- Type: Union[Dict[str, Any], List[Any]]
Examples
>>> hyp = Hypothesis(score=0.5, yseq=[1, 2, 3], dec_state=torch.zeros(1, 256))
>>> print(hyp.score)
0.5
>>> print(hyp.yseq)
[1, 2, 3]
dec_state : Tuple[Tensor, Tensor | [None](AbsDecoder.md#espnet2.asr.decoder.abs_decoder.AbsDecoder.None)] | List[Tensor | None] | Tensor
lm_state
score
yseq