class_docstr: Adapted Transformer model (https://arxiv.org/abs/1706.03762) for
  speech-to-text tasks. The Transformer encoder/decoder remains the same.
  A trainable input subsampler is prepended to the Transformer encoder to
  project inputs into the encoder dimension as well as downsample input
  sequence for computational efficiency.
class_docstr_tok: ["Adapted","Transformer","model","(","https",":","\/\/arxiv.org\/abs\/1706.03762",")","for","speech-to-text","tasks",".","The","Transformer","encoder\/decoder","remains","the","same",".","A","trainable","input","subsampler","is","prepended","to","the","Transformer","encoder","to","project","inputs","into","the","encoder","dimension","as","well","as","downsample","input","sequence","for","computational","efficiency","."]
docstr: Build a new model instance.
docstr_tok: ["Build","a","new","model","instance","."]
code: def build_model(cls, args, task):
      """Build a new model instance."""
  
      # make sure all arguments are present in older models
      base_architecture(args)
  
      def build_embedding(dictionary, embed_dim):
          num_embeddings = len(dictionary)
          padding_idx = dictionary.pad()
          return Embedding(num_embeddings, embed_dim, padding_idx)
  
      decoder_embed_tokens = build_embedding(
          task.target_dictionary, args.decoder_embed_dim
      )
      args.tgt_dict_size = len(task.target_dictionary)
      encoder = cls.build_encoder(args)
      decoder = cls.build_decoder(args, task, decoder_embed_tokens)
      return cls(encoder, decoder)
  
imports: import logging
  import math
  from pathlib import Path
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  from torch import Tensor
  from fairseq import checkpoint_utils, utils
  from fairseq.data.data_utils import lengths_to_padding_mask
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.speech_to_text.hub_interface import S2THubInterface
  from fairseq.models.speech_to_text.modules.convolution import Conv1dSubsampler, Conv2dSubsampler
  from fairseq.models.transformer import Embedding, TransformerDecoder
  from fairseq.modules import FairseqDropout, LayerNorm, PositionalEmbedding, TransformerEncoderLayer
label_desc: Use image node_id 7 for calling the S2TTransformerModel obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: cls, Embedding