espnet2.aqa.ar_universa.universa_beam_search.ARUniVERSABeamSearch
espnet2.aqa.ar_universa.universa_beam_search.ARUniVERSABeamSearch
class espnet2.aqa.ar_universa.universa_beam_search.ARUniVERSABeamSearch(scorers: Dict[str, ScorerInterface | None], weights: Dict[str, float], beam_size: int, vocab_size: int, sos: int, eos: int, meta_label_for_search: List[int], token_list: List[str] | None = None, skip_meta_label_score: bool = False, beam_masking: Dict[int, Tuple[int, int]] | None = None, use_fixed_order: bool = False)
Bases: BeamSearch
Schedule metric/value pairs using ESPnet’s shared token search.
Each result contains SOS followed by exactly one pair per requested metric. EOS is accepted for compatibility with the model’s decoder configuration, but is neither appended nor scored; completion is determined by pair count.
Both BeamSearch and BatchBeamSearch normally prune after every token. Here all retained label branches compete only after their value is scored. When label scores are skipped, every allowed label must reach the value step, even with beam_size=1. A mask alone cannot express this pruning schedule. Only this pair schedule and fixed-length termination are specialized; token expansion, score/state merging, hypotheses, and module registration come from BeamSearch. BatchBeamSearch supports batching both hypotheses and utterances, but its token-level pruning/termination needs the same schedule adaptation before it can replace this single-utterance entry point.
Configure full scorers and the requested metric/value constraints.
beam_masking maps metric label IDs to half-open value-token ranges. skip_meta_label_score ignores label scores while still advancing scorer states. use_fixed_order follows meta_label_for_search. Other arguments follow BeamSearch; partial scorers are not supported by this fixed-pair decoder.
beam(weighted_scores, ids)
Keep only finite candidates, including when the beam exceeds a range.
forward(x: Tensor) → List[Hypothesis]
Decode a single encoded utterance (T, D) into complete metric pairs.
score_full(hyp, x, pre_x=None)
Advance all states, optionally ignoring the model’s label scores.
search(running_hyps, x, pre_x=None)
Expand labels per parent, then prune globally after the value step.
