class_docstr: ESPnet speech-to-speech translation model
code: def __init__(
      self,
      s2st_type: str,
      frontend: Optional[AbsFrontend],
      tgt_feats_extract: Optional[AbsTgtFeatsExtract],
      specaug: Optional[AbsSpecAug],
      src_normalize: Optional[AbsNormalize],
      tgt_normalize: Optional[AbsNormalize],
      preencoder: Optional[AbsPreEncoder],
      encoder: AbsEncoder,
      postencoder: Optional[AbsPostEncoder],
      asr_decoder: Optional[AbsDecoder],
      st_decoder: Optional[AbsDecoder],
      aux_attention: Optional[AbsS2STAuxAttention],
      unit_encoder: Optional[AbsEncoder],
      synthesizer: Optional[AbsSynthesizer],
      asr_ctc: Optional[CTC],
      st_ctc: Optional[CTC],
      losses: Dict[str, AbsS2STLoss],
      tgt_vocab_size: Optional[int],
      tgt_token_list: Optional[Union[Tuple[str, ...], List[str]]],
      src_vocab_size: Optional[int],
      src_token_list: Optional[Union[Tuple[str, ...], List[str]]],
      unit_vocab_size: Optional[int],
      unit_token_list: Optional[Union[Tuple[str, ...], List[str]]],
      ignore_id: int = -1,
      report_cer: bool = True,
      report_wer: bool = True,
      report_bleu: bool = True,
      sym_space: str = "<space>",
      sym_blank: str = "<blank>",
      extract_feats_in_collect_stats: bool = True,
  ):
      assert check_argument_types()
  
      super().__init__()
      self.sos = tgt_vocab_size - 1 if tgt_vocab_size else None
      self.eos = tgt_vocab_size - 1 if tgt_vocab_size else None
      self.src_sos = src_vocab_size - 1 if src_vocab_size else None
      self.src_eos = src_vocab_size - 1 if src_vocab_size else None
      self.unit_sos = unit_vocab_size - 1 if unit_vocab_size else None
      self.unit_eos = unit_vocab_size - 1 if unit_vocab_size else None
      self.tgt_vocab_size = tgt_vocab_size
      self.src_vocab_size = src_vocab_size
      self.unit_vocab_size = unit_vocab_size
      self.ignore_id = ignore_id
      self.tgt_token_list = (
          tgt_token_list.copy() if tgt_token_list else None
      )
      self.src_token_list = (
          src_token_list.copy() if src_token_list else None
      )
      self.unit_token_list = (
          unit_token_list.copy() if unit_token_list else None
      )
      self.s2st_type = s2st_type
  
      self.frontend = frontend
      self.tgt_feats_extract = tgt_feats_extract
      self.specaug = specaug
      self.src_normalize = src_normalize
      self.tgt_normalize = tgt_normalize
      self.preencoder = preencoder
      self.postencoder = postencoder
      self.encoder = encoder
      self.asr_decoder = asr_decoder
      self.st_decoder = st_decoder
      self.aux_attention = aux_attention
      self.unit_encoder = unit_encoder
      self.synthesizer = synthesizer
      self.asr_ctc = asr_ctc
      self.st_ctc = st_ctc
      self.losses = torch.nn.ModuleDict(losses)
  
      # ST error calculator
      if st_decoder and tgt_vocab_size and report_bleu:
          self.mt_error_calculator = MTErrorCalculator(
              tgt_token_list, sym_space, sym_blank, report_bleu
          )
      else:
          self.mt_error_calculator = None
  
      # ASR error calculator
      if asr_decoder and src_vocab_size and (report_cer or report_wer):
          assert (
              src_token_list is not None
          ), "Missing src_token_list, cannot add asr module to st model"
          self.asr_error_calculator = ASRErrorCalculator(
              src_token_list,
              sym_space,
              sym_blank,
              report_cer,
              report_wer,
          )
      else:
          self.asr_error_calculator = None
  
      self.extract_feats_in_collect_stats = (
          extract_feats_in_collect_stats
      )
  
      if self.s2st_type == "discrete_unit":
          assert isinstance(
              self.encoder, ConformerEncoder
          ) or isinstance(
              self.encoder, TransformerEncoder
          ), "only support conformer or transformer-based encoder now"
  
      # synthesizer
      assert (
          "synthesis" in self.losses
      ), "must have synthesis loss in the losses for S2ST"
  
imports: import logging
  from contextlib import contextmanager
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.asr.ctc import CTC
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet2.asr.encoder.conformer_encoder import ConformerEncoder
  from espnet2.asr.encoder.transformer_encoder import TransformerEncoder
  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.s2st.aux_attention.abs_aux_attention import AbsS2STAuxAttention
  from espnet2.s2st.losses.abs_loss import AbsS2STLoss
  from espnet2.s2st.synthesizer.abs_synthesizer import AbsSynthesizer
  from espnet2.s2st.tgt_feats_extract.abs_tgt_feats_extract import AbsTgtFeatsExtract
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.train.abs_espnet_model import AbsESPnetModel
  from espnet.nets.e2e_asr_common import ErrorCalculator
  from espnet.nets.e2e_mt_common import ErrorCalculator
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask, th_accuracy
  from espnet.nets.pytorch_backend.transformer.add_sos_eos import add_sos_eos
label_desc: Use image node_id 1 to create a new ESPnetS2STModel object from inherited base classes: AbsESPnetModel with example: obj = ESPnetS2STModel(s2st_type, frontend, tgt_feats_extract, specaug, src_normalize, tgt_normalize, preencoder, encoder, postencoder, asr_decoder, st_decoder, aux_attention, unit_encoder, synthesizer, asr_ctc, st_ctc, losses, tgt_vocab_size, tgt_token_list, src_vocab_size, src_token_list, unit_vocab_size, unit_token_list, ignore_id, report_cer, report_wer, report_bleu, sym_space, sym_blank, extract_feats_in_collect_stats)