docstr: Add model-specific arguments to the parser.
docstr_tok: ["Add","model-specific","arguments","to","the","parser","."]
code: def add_args(parser):
      """Add model-specific arguments to the parser."""
      # wav2vec encoder
      Wav2VecEncoderWithAdaptor.add_args(parser)
      # add_decoder_args(parser)
      # mbart Transformer
      parser.add_argument(
          "--activation-fn",
          type=str,
          default="relu",
          choices=utils.get_available_activation_fns(),
          help="activation function to use",
      )
  
      parser.add_argument(
          "--mbart-dropout",
          type=float,
          metavar="D",
          help="dropout probability",
      )
      parser.add_argument(
          "--mbart-attention-dropout",
          type=float,
          metavar="D",
          help="dropout probability for attention weights",
      )
      parser.add_argument(
          "--mbart-activation-dropout",
          type=float,
          metavar="D",
          help="dropout probability after activation in FFN.",
      )
  
      parser.add_argument(
          "--encoder-embed-dim",
          type=int,
          metavar="N",
          help="encoder embedding dimension",
      )
      parser.add_argument(
          "--encoder-ffn-embed-dim",
          type=int,
          metavar="N",
          help="encoder embedding dimension for FFN",
      )
      parser.add_argument(
          "--encoder-layers",
          type=int,
          metavar="N",
          help="num encoder layers",
      )
      parser.add_argument(
          "--encoder-attention-heads",
          type=int,
          metavar="N",
          help="num encoder attention heads",
      )
      parser.add_argument(
          "--encoder-normalize-before",
          action="store_true",
          help="apply layernorm before each encoder block",
      )
  
      parser.add_argument(
          "--decoder-embed-dim",
          type=int,
          metavar="N",
          help="decoder embedding dimension",
      )
      parser.add_argument(
          "--decoder-ffn-embed-dim",
          type=int,
          metavar="N",
          help="decoder embedding dimension for FFN",
      )
      parser.add_argument(
          "--decoder-layers",
          type=int,
          metavar="N",
          help="num decoder layers",
      )
      parser.add_argument(
          "--decoder-attention-heads",
          type=int,
          metavar="N",
          help="num decoder attention heads",
      )
      parser.add_argument(
          "--decoder-normalize-before",
          action="store_true",
          help="apply layernorm before each decoder block",
      )
      parser.add_argument(
          "--layernorm-embedding",
          action="store_true",
          help="add layernorm to embedding",
      )
      parser.add_argument(
          "--no-scale-embedding",
          action="store_true",
          help="if True, dont scale embeddings",
      )
      parser.add_argument(
          "--load-pretrained-mbart-from",
          type=str,
          metavar="STR",
          help="model to take text encoder decoder weights from (for initialization)",
      )
      # parser.add_argument("--finetune-w2v-params", type=str, metavar="STR",
      #                    help="comma-separated param strings to finetune.")
      parser.add_argument(
          "--finetune-mbart-decoder-params",
          type=str,
          metavar="STR",
          help="comma-separated param strings to finetune.",
      )
      parser.add_argument(
          "--finetune-mbart-encoder-params",
          type=str,
          metavar="STR",
          help="comma-separated param strings to finetune.",
      )
      parser.add_argument(
          "--skip-encoder-projection",
          action="store_true",
          help="skip the projection layer in encoder",
      )
  
      parser.add_argument(
          "--enc-grad-mult",
          type=float,
          metavar="V",
          default=1.0,
          help="multiply enc1 and enc2 gradient by V",
      )
      parser.add_argument(
          "--enc2-along-grad-mult",
          type=float,
          metavar="V",
          default=1.0,
          help="multiply enc2 gradient by V if only enc2 is used",
      )
      parser.add_argument(
          "--text-input-cost-ratio",
          type=float,
          default=1.0,
          metavar="V",
          help="text input cost ratio relative to speech input cost",
      )
      parser.add_argument(
          "--stack-w2v-mbart-encoder",
          action="store_true",
          help="stack w2v and mbart encoder",
      )
      parser.add_argument(
          "--stack-w2v-mbart-nonorm-encoder",
          action="store_true",
          help="stack w2v and mbart encoder",
      )
      parser.add_argument(
          "--no-final-norm-decoder",
          action="store_true",
          help="no layer norm",
      )
      parser.add_argument(
          "--drop-w2v-layers",
          type=int,
          default=0,
          metavar="N",
          help="drop w2v encoder layers",
      )
  
      parser.add_argument(
          "--share-w2v-text-encoder",
          action="store_true",
          help="share w2v encoder layers with text encoder",
      )
      parser.add_argument(
          "--shared-w2v-layers",
          type=int,
          default=0,
          metavar="N",
          help="shared encoder layers from w2v encoder",
      )
  
imports: import copy
  import torch.nn
  from fairseq import checkpoint_utils
  from fairseq import utils
  from fairseq.data.data_utils import lengths_to_padding_mask
  from fairseq.models import register_model, register_model_architecture, FairseqEncoder
  from fairseq.models.speech_to_text import Wav2VecEncoderWithAdaptor
  from fairseq.models.speech_to_text.xm_transformer import set_default_adaptor_args, set_default_w2v_encoder_args, need_finetuning
  from fairseq.models.transformer import TransformerEncoder, TransformerDecoder
  from fairseq.models.wav2vec import TransformerSentenceEncoderLayer
  from fairseq.utils import safe_hasattr
  from .s2t_dualinputtransformer import DualInputS2TTransformerModel, TransformerMultiInputDecoder, DualInputEncoder
label_desc: Use image node_id 2 for calling the DualInputXMTransformerModel obj's underlying member method code with example usage: obj.add_args(parser) without return types