class_docstr: Hybrid CTC/Masked LM Encoder-Decoder model (Mask-CTC)
class_docstr_tok: ["Hybrid","CTC\/Masked","LM","Encoder-Decoder","model","(","Mask-CTC",")"]
code: def __init__(
      self,
      vocab_size: int,
      token_list: Union[Tuple[str, ...], List[str]],
      frontend: Optional[AbsFrontend],
      specaug: Optional[AbsSpecAug],
      normalize: Optional[AbsNormalize],
      preencoder: Optional[AbsPreEncoder],
      encoder: AbsEncoder,
      postencoder: Optional[AbsPostEncoder],
      decoder: MLMDecoder,
      ctc: CTC,
      joint_network: Optional[torch.nn.Module] = None,
      ctc_weight: float = 0.5,
      interctc_weight: float = 0.0,
      ignore_id: int = -1,
      lsm_weight: float = 0.0,
      length_normalized_loss: bool = False,
      report_cer: bool = True,
      report_wer: bool = True,
      sym_space: str = "<space>",
      sym_blank: str = "<blank>",
      sym_mask: str = "<mask>",
      extract_feats_in_collect_stats: bool = True,
  ):
      assert check_argument_types()
  
      super().__init__(
          vocab_size=vocab_size,
          token_list=token_list,
          frontend=frontend,
          specaug=specaug,
          normalize=normalize,
          preencoder=preencoder,
          encoder=encoder,
          postencoder=postencoder,
          decoder=decoder,
          ctc=ctc,
          joint_network=joint_network,
          ctc_weight=ctc_weight,
          interctc_weight=interctc_weight,
          ignore_id=ignore_id,
          lsm_weight=lsm_weight,
          length_normalized_loss=length_normalized_loss,
          report_cer=report_cer,
          report_wer=report_wer,
          sym_space=sym_space,
          sym_blank=sym_blank,
          extract_feats_in_collect_stats=extract_feats_in_collect_stats,
      )
  
      # Add <mask> and override inherited fields
      token_list.append(sym_mask)
      vocab_size += 1
      self.vocab_size = vocab_size
      self.mask_token = vocab_size - 1
      self.token_list = token_list.copy()
  
      # MLM loss
      del self.criterion_att
      self.criterion_mlm = LabelSmoothingLoss(
          size=vocab_size,
          padding_idx=ignore_id,
          smoothing=lsm_weight,
          normalize_length=length_normalized_loss,
      )
  
      self.error_calculator = None
      if report_cer or report_wer:
          self.error_calculator = ErrorCalculator(
              token_list, sym_space, sym_blank, report_cer, report_wer
          )
  
imports: import logging
  from contextlib import contextmanager
  from itertools import groupby
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.asr.ctc import CTC
  from espnet2.asr.decoder.mlm_decoder import MLMDecoder
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet2.asr.espnet_model import ESPnetASRModel
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
  from espnet2.asr.postencoder.abs_postencoder import AbsPostEncoder
  from espnet2.asr.preencoder.abs_preencoder import AbsPreEncoder
  from espnet2.asr.specaug.abs_specaug import AbsSpecAug
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.text.token_id_converter import TokenIDConverter
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet.nets.beam_search import Hypothesis
  from espnet.nets.e2e_asr_common import ErrorCalculator
  from espnet.nets.pytorch_backend.maskctc.add_mask_token import mask_uniform
  from espnet.nets.pytorch_backend.nets_utils import th_accuracy
  from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import LabelSmoothingLoss
label_desc: Use image node_id 1 to create a new MaskCTCModel object from inherited base classes: ESPnetASRModel with example: obj = MaskCTCModel(vocab_size, token_list, frontend, specaug, normalize, preencoder, encoder, postencoder, decoder, ctc, joint_network, ctc_weight, interctc_weight, ignore_id, lsm_weight, length_normalized_loss, report_cer, report_wer, sym_space, sym_blank, sym_mask, extract_feats_in_collect_stats)