File size: 495 Bytes
32b542e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from uniperceiver.utils.registry import Registry
DECODE_STRATEGY_REGISTRY = Registry("DECODE_STRATEGY")
DECODE_STRATEGY_REGISTRY.__doc__ = """
Registry for decode strategy
"""
def build_beam_searcher(cfg):
beam_search = None if cfg.DECODE_STRATEGY.NAME.lower() == "none" else DECODE_STRATEGY_REGISTRY.get(cfg.DECODE_STRATEGY.NAME)(cfg)
return beam_search
def build_greedy_decoder(cfg):
greedy_decoder = DECODE_STRATEGY_REGISTRY.get("GreedyDecoder")(cfg)
return greedy_decoder |