mbrs.decoders.centroid_mbr module#
- class mbrs.decoders.centroid_mbr.DecoderCentroidMBR(cfg: ~mbrs.decoders.centroid_mbr.DecoderCentroidMBR.Config, metric: ~mbrs.metrics.base.MetricAggregatableCache, selector: ~mbrs.selectors.base.Selector = <mbrs.selectors.nbest.SelectorNbest object>)[source]#
Bases:
DecoderMBRCentroid-Based MBR decoder class.
Time complexity: O(Nk)
Space complexity: O(Nk)
where k << N.
References
H. Deguchi et al., 2024. “Centroid-Based Efficient Minimum Bayes Risk Decoding”. https://aclanthology.org/2024.findings-acl.654
- class Config(kmeans: ~mbrs.modules.kmeans.Kmeans.Config = <factory>, count_weight: bool = False)[source]#
Bases:
ConfigConfiguration for the decoder.
kmeans (Kmeans.Config): Configuration for k-means.
count_weight: (bool) Weight the scores with counts.
- decode(hypotheses: list[str], references: list[str], source: str | None = None, nbest: int = 1, reference_lprobs: Tensor | None = None) Output[source]#
Select the n-best hypotheses based on the strategy.
- Parameters:
- Returns:
The n-best hypotheses.
- Return type:
DecoderCentroidMBR.Output