class_docstr: VC Transformer module.
  
  This is a module of the Voice Transformer Network
  (a.k.a. VTN or Transformer-VC) described in
  `Voice Transformer Network: Sequence-to-Sequence
  Voice Conversion Using Transformer with
  Text-to-Speech Pretraining`_,
  which convert the sequence of acoustic features
  into the sequence of acoustic features.
  
  .. _`Voice Transformer Network: Sequence-to-Sequence
      Voice Conversion Using Transformer with
      Text-to-Speech Pretraining`:
      https://arxiv.org/pdf/1912.06813.pdf
class_docstr_tok: ["VC","Transformer","module",".","This","is","a","module","of","the","Voice","Transformer","Network","(","a.k.a",".","VTN","or","Transformer-VC",")","described","in","`","Voice","Transformer","Network",":","Sequence-to-Sequence","Voice","Conversion","Using","Transformer","with","Text-to-Speech","Pretraining","`","_",",","which","convert","the","sequence","of","acoustic","features","into","the","sequence","of","acoustic","features",".","..","_","`","Voice","Transformer","Network",":","Sequence-to-Sequence","Voice","Conversion","Using","Transformer","with","Text-to-Speech","Pretraining","`",":","https",":","\/\/arxiv.org\/pdf\/1912.06813.pdf"]
docstr: Add model-specific arguments to the parser.
docstr_tok: ["Add","model-specific","arguments","to","the","parser","."]
code: def add_arguments(parser):
      """Add model-specific arguments to the parser."""
      group = parser.add_argument_group("transformer model setting")
      # network structure related
      group.add_argument(
          "--eprenet-conv-layers",
          default=0,
          type=int,
          help="Number of encoder prenet convolution layers",
      )
      group.add_argument(
          "--eprenet-conv-chans",
          default=0,
          type=int,
          help="Number of encoder prenet convolution channels",
      )
      group.add_argument(
          "--eprenet-conv-filts",
          default=0,
          type=int,
          help="Filter size of encoder prenet convolution",
      )
      group.add_argument(
          "--transformer-input-layer",
          default="linear",
          type=str,
          help="Type of input layer (linear or conv2d)",
      )
      group.add_argument(
          "--dprenet-layers",
          default=2,
          type=int,
          help="Number of decoder prenet layers",
      )
      group.add_argument(
          "--dprenet-units",
          default=256,
          type=int,
          help="Number of decoder prenet hidden units",
      )
      group.add_argument(
          "--elayers",
          default=3,
          type=int,
          help="Number of encoder layers",
      )
      group.add_argument(
          "--eunits",
          default=1536,
          type=int,
          help="Number of encoder hidden units",
      )
      group.add_argument(
          "--adim",
          default=384,
          type=int,
          help="Number of attention transformation dimensions",
      )
      group.add_argument(
          "--aheads",
          default=4,
          type=int,
          help="Number of heads for multi head attention",
      )
      group.add_argument(
          "--dlayers",
          default=3,
          type=int,
          help="Number of decoder layers",
      )
      group.add_argument(
          "--dunits",
          default=1536,
          type=int,
          help="Number of decoder hidden units",
      )
      group.add_argument(
          "--positionwise-layer-type",
          default="linear",
          type=str,
          choices=["linear", "conv1d", "conv1d-linear"],
          help="Positionwise layer type.",
      )
      group.add_argument(
          "--positionwise-conv-kernel-size",
          default=1,
          type=int,
          help="Kernel size of positionwise conv1d layer",
      )
      group.add_argument(
          "--postnet-layers",
          default=5,
          type=int,
          help="Number of postnet layers",
      )
      group.add_argument(
          "--postnet-chans",
          default=256,
          type=int,
          help="Number of postnet channels",
      )
      group.add_argument(
          "--postnet-filts",
          default=5,
          type=int,
          help="Filter size of postnet",
      )
      group.add_argument(
          "--use-scaled-pos-enc",
          default=True,
          type=strtobool,
          help="Use trainable scaled positional encoding"
          "instead of the fixed scale one.",
      )
      group.add_argument(
          "--use-batch-norm",
          default=True,
          type=strtobool,
          help="Whether to use batch normalization",
      )
      group.add_argument(
          "--encoder-normalize-before",
          default=False,
          type=strtobool,
          help="Whether to apply layer norm before encoder block",
      )
      group.add_argument(
          "--decoder-normalize-before",
          default=False,
          type=strtobool,
          help="Whether to apply layer norm before decoder block",
      )
      group.add_argument(
          "--encoder-concat-after",
          default=False,
          type=strtobool,
          help="Whether to concatenate attention layer's input and output in encoder",
      )
      group.add_argument(
          "--decoder-concat-after",
          default=False,
          type=strtobool,
          help="Whether to concatenate attention layer's input and output in decoder",
      )
      group.add_argument(
          "--reduction-factor",
          default=1,
          type=int,
          help="Reduction factor (for decoder)",
      )
      group.add_argument(
          "--encoder-reduction-factor",
          default=1,
          type=int,
          help="Reduction factor (for encoder)",
      )
      group.add_argument(
          "--spk-embed-dim",
          default=None,
          type=int,
          help="Number of speaker embedding dimensions",
      )
      group.add_argument(
          "--spk-embed-integration-type",
          type=str,
          default="add",
          choices=["add", "concat"],
          help="How to integrate speaker embedding",
      )
      # training related
      group.add_argument(
          "--transformer-init",
          type=str,
          default="pytorch",
          choices=[
              "pytorch",
              "xavier_uniform",
              "xavier_normal",
              "kaiming_uniform",
              "kaiming_normal",
          ],
          help="How to initialize transformer parameters",
      )
      group.add_argument(
          "--initial-encoder-alpha",
          type=float,
          default=1.0,
          help="Initial alpha value in encoder's ScaledPositionalEncoding",
      )
      group.add_argument(
          "--initial-decoder-alpha",
          type=float,
          default=1.0,
          help="Initial alpha value in decoder's ScaledPositionalEncoding",
      )
      group.add_argument(
          "--transformer-lr",
          default=1.0,
          type=float,
          help="Initial value of learning rate",
      )
      group.add_argument(
          "--transformer-warmup-steps",
          default=4000,
          type=int,
          help="Optimizer warmup steps",
      )
      group.add_argument(
          "--transformer-enc-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer encoder except for attention",
      )
      group.add_argument(
          "--transformer-enc-positional-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer encoder positional encoding",
      )
      group.add_argument(
          "--transformer-enc-attn-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer encoder self-attention",
      )
      group.add_argument(
          "--transformer-dec-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer decoder "
          "except for attention and pos encoding",
      )
      group.add_argument(
          "--transformer-dec-positional-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer decoder positional encoding",
      )
      group.add_argument(
          "--transformer-dec-attn-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer decoder self-attention",
      )
      group.add_argument(
          "--transformer-enc-dec-attn-dropout-rate",
          default=0.1,
          type=float,
          help="Dropout rate for transformer encoder-decoder attention",
      )
      group.add_argument(
          "--eprenet-dropout-rate",
          default=0.5,
          type=float,
          help="Dropout rate in encoder prenet",
      )
      group.add_argument(
          "--dprenet-dropout-rate",
          default=0.5,
          type=float,
          help="Dropout rate in decoder prenet",
      )
      group.add_argument(
          "--postnet-dropout-rate",
          default=0.5,
          type=float,
          help="Dropout rate in postnet",
      )
      group.add_argument(
          "--pretrained-model",
          default=None,
          type=str,
          help="Pretrained model path",
      )
  
      # loss related
      group.add_argument(
          "--use-masking",
          default=True,
          type=strtobool,
          help="Whether to use masking in calculation of loss",
      )
      group.add_argument(
          "--use-weighted-masking",
          default=False,
          type=strtobool,
          help="Whether to use weighted masking in calculation of loss",
      )
      group.add_argument(
          "--loss-type",
          default="L1",
          choices=["L1", "L2", "L1+L2"],
          help="How to calc loss",
      )
      group.add_argument(
          "--bce-pos-weight",
          default=5.0,
          type=float,
          help="Positive sample weight in BCE calculation "
          "(only for use-masking=True)",
      )
      group.add_argument(
          "--use-guided-attn-loss",
          default=False,
          type=strtobool,
          help="Whether to use guided attention loss",
      )
      group.add_argument(
          "--guided-attn-loss-sigma",
          default=0.4,
          type=float,
          help="Sigma in guided attention loss",
      )
      group.add_argument(
          "--guided-attn-loss-lambda",
          default=1.0,
          type=float,
          help="Lambda in guided attention loss",
      )
      group.add_argument(
          "--num-heads-applied-guided-attn",
          default=2,
          type=int,
          help="Number of heads in each layer to be applied guided attention loss"
          "if set -1, all of the heads will be applied.",
      )
      group.add_argument(
          "--num-layers-applied-guided-attn",
          default=2,
          type=int,
          help="Number of layers to be applied guided attention loss"
          "if set -1, all of the layers will be applied.",
      )
      group.add_argument(
          "--modules-applied-guided-attn",
          type=str,
          nargs="+",
          default=["encoder-decoder"],
          help="Module name list to be applied guided attention loss",
      )
      return parser
  
imports: import logging
  import torch
  import torch.nn.functional
  from espnet.nets.pytorch_backend.e2e_asr_transformer import subsequent_mask
  from espnet.nets.pytorch_backend.e2e_tts_tacotron2 import Tacotron2Loss
  from espnet.nets.pytorch_backend.e2e_tts_transformer import TTSPlot
  from espnet.nets.pytorch_backend.e2e_tts_transformer import GuidedMultiHeadAttentionLoss
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
  from espnet.nets.pytorch_backend.tacotron2.decoder import Postnet
  from espnet.nets.pytorch_backend.tacotron2.decoder import Prenet
  from espnet.nets.pytorch_backend.tacotron2.encoder import Encoder
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.decoder import Decoder
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
  from espnet.nets.pytorch_backend.transformer.initializer import initialize
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.cli_utils import strtobool
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 1 for calling the Transformer obj's underlying member method code with example usage: obj.add_arguments(parser) and returns: parser