espnet2.aqa.ar_universa.universa_beam_search.MetricConstraintScorer
Less than 1 minute
espnet2.aqa.ar_universa.universa_beam_search.MetricConstraintScorer
class espnet2.aqa.ar_universa.universa_beam_search.MetricConstraintScorer(vocab_size, labels, beam_masking, use_fixed_order)
Bases: BatchScorerInterface
Allow unused metric labels and their values with a zero/-inf mask.
The prefix is the source of truth for metric order and completion; no separate per-hypothesis list of unused labels needs to be maintained. The scorer also supports the shared BatchBeamSearch scorer interface.
Store the metric vocabulary, value ranges, and ordering policy.
batch_score(ys, states, xs)
Build independent masks for hypotheses and utterances in a batch.
score(y, state, x)
Mask tokens using the alternating label/value prefix after SOS.
