def decode_dataset(dl: torch.utils.data.DataLoader, params: AttributeDict, model: nn.Module, HLG: Optional[k2.Fsa], H: Optional[k2.Fsa], bpe_model: Optional[spm.SentencePieceProcessor], word_table: k2.SymbolTable, sos_id: int, eos_id: int, G: Optional[k2.Fsa]=None) -> Dict[(str, List[Tuple[(List[str], List[str])]])]:
    'Decode dataset.\n\n    Args:\n      dl:\n        PyTorch\'s dataloader containing the dataset to decode.\n      params:\n        It is returned by :func:`get_params`.\n      model:\n        The neural model.\n      HLG:\n        The decoding graph. Used only when params.method is NOT ctc-decoding.\n      H:\n        The ctc topo. Used only when params.method is ctc-decoding.\n      bpe_model:\n        The BPE model. Used only when params.method is ctc-decoding.\n      word_table:\n        It is the word symbol table.\n      sos_id:\n        The token ID for SOS.\n      eos_id:\n        The token ID for EOS.\n      G:\n        An LM. It is not None when params.method is "nbest-rescoring"\n        or "whole-lattice-rescoring". In general, the G in HLG\n        is a 3-gram LM, while this G is a 4-gram LM.\n    Returns:\n      Return a dict, whose key may be "no-rescore" if no LM rescoring\n      is used, or it may be "lm_scale_0.7" if LM rescoring is used.\n      Its value is a list of tuples. Each tuple contains two elements:\n      The first is the reference transcript, and the second is the\n      predicted result.\n    '
    results = []
    num_cuts = 0
    try:
        num_batches = len(dl)
    except TypeError:
        num_batches = '?'
    results = defaultdict(list)
    for (batch_idx, batch) in enumerate(dl):
        texts = batch['supervisions']['text']
        hyps_dict = decode_one_batch(params=params, model=model, HLG=HLG, H=H, bpe_model=bpe_model, batch=batch, word_table=word_table, G=G, sos_id=sos_id, eos_id=eos_id)
        for (lm_scale, hyps) in hyps_dict.items():
            this_batch = []
            assert (len(hyps) == len(texts))
            for (hyp_words, ref_text) in zip(hyps, texts):
                ref_words = ref_text.split()
                this_batch.append((ref_words, hyp_words))
            results[lm_scale].extend(this_batch)
        num_cuts += len(batch['supervisions']['text'])
        if ((batch_idx % 100) == 0):
            batch_str = f'{batch_idx}/{num_batches}'
            logging.info(f'batch {batch_str}, cuts processed until now is {num_cuts}')
    return results
Decode dataset.

Args:
  dl:
    PyTorch's dataloader containing the dataset to decode.
  params:
    It is returned by :func:`get_params`.
  model:
    The neural model.
  HLG:
    The decoding graph. Used only when params.method is NOT ctc-decoding.
  H:
    The ctc topo. Used only when params.method is ctc-decoding.
  bpe_model:
    The BPE model. Used only when params.method is ctc-decoding.
  word_table:
    It is the word symbol table.
  sos_id:
    The token ID for SOS.
  eos_id:
    The token ID for EOS.
  G:
    An LM. It is not None when params.method is "nbest-rescoring"
    or "whole-lattice-rescoring". In general, the G in HLG
    is a 3-gram LM, while this G is a 4-gram LM.
Returns:
  Return a dict, whose key may be "no-rescore" if no LM rescoring
  is used, or it may be "lm_scale_0.7" if LM rescoring is used.
  Its value is a list of tuples. Each tuple contains two elements:
  The first is the reference transcript, and the second is the
  predicted result.
def decode_dataset(dl: torch.utils.data.DataLoader, params: AttributeDict, model: nn.Module, HLG: Optional[k2.Fsa], H: Optional[k2.Fsa], bpe_model: Optional[spm.SentencePieceProcessor], word_table: k2.SymbolTable, sos_id: int, eos_id: int, G: Optional[k2.Fsa]=None) -> Dict[(str, List[Tuple[(List[str], List[str])]])]:
    'Decode dataset.\n\n    Args:\n      dl:\n        PyTorch\'s dataloader containing the dataset to decode.\n      params:\n        It is returned by :func:`get_params`.\n      model:\n        The neural model.\n      HLG:\n        The decoding graph. Used only when params.method is NOT ctc-decoding.\n      H:\n        The ctc topo. Used only when params.method is ctc-decoding.\n      bpe_model:\n        The BPE model. Used only when params.method is ctc-decoding.\n      word_table:\n        It is the word symbol table.\n      sos_id:\n        The token ID for SOS.\n      eos_id:\n        The token ID for EOS.\n      G:\n        An LM. It is not None when params.method is "nbest-rescoring"\n        or "whole-lattice-rescoring". In general, the G in HLG\n        is a 3-gram LM, while this G is a 4-gram LM.\n    Returns:\n      Return a dict, whose key may be "no-rescore" if no LM rescoring\n      is used, or it may be "lm_scale_0.7" if LM rescoring is used.\n      Its value is a list of tuples. Each tuple contains two elements:\n      The first is the reference transcript, and the second is the\n      predicted result.\n    '
    results = []
    num_cuts = 0
    try:
        num_batches = len(dl)
    except TypeError:
        num_batches = '?'
    results = defaultdict(list)
    for (batch_idx, batch) in enumerate(dl):
        texts = batch['supervisions']['text']
        hyps_dict = decode_one_batch(params=params, model=model, HLG=HLG, H=H, bpe_model=bpe_model, batch=batch, word_table=word_table, G=G, sos_id=sos_id, eos_id=eos_id)
        for (lm_scale, hyps) in hyps_dict.items():
            this_batch = []
            assert (len(hyps) == len(texts))
            for (hyp_words, ref_text) in zip(hyps, texts):
                ref_words = ref_text.split()
                this_batch.append((ref_words, hyp_words))
            results[lm_scale].extend(this_batch)
        num_cuts += len(batch['supervisions']['text'])
        if ((batch_idx % 100) == 0):
            batch_str = f'{batch_idx}/{num_batches}'
            logging.info(f'batch {batch_str}, cuts processed until now is {num_cuts}')
    return results