class_docstr: Two phase decoding:
  www.microsoft.com/en-us/research/uploads/prod/2018/03/final-achieving-human.pdf
  Args:
      encoder (TransformerEncoder): the encoder
      decoder (TransformerTwoPhaseDecoder): the decoder
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)
  
      if not hasattr(args, "max_source_positions"):
          args.max_source_positions = DEFAULT_MAX_SOURCE_POSITIONS
      if not hasattr(args, "max_target_positions"):
          args.max_target_positions = DEFAULT_MAX_TARGET_POSITIONS
  
      src_dict, tgt_dict = (
          task.source_dictionary,
          task.target_dictionary,
      )
  
      def build_embedding(dictionary, embed_dim, path=None):
          num_embeddings = len(dictionary)
          padding_idx = dictionary.pad()
          emb = Embedding(num_embeddings, embed_dim, padding_idx)
          # if provided, load from preloaded dictionaries
          if path:
              embed_dict = utils.parse_embedding(path)
              utils.load_embedding(embed_dict, dictionary, emb)
          return emb
  
      if args.share_all_embeddings:
          if src_dict != tgt_dict:
              raise ValueError(
                  "--share-all-embeddings requires a joined dictionary"
              )
          if args.encoder_embed_dim != args.decoder_embed_dim:
              raise ValueError(
                  "--share-all-embeddings requires --encoder-embed-dim "
                  "to match --decoder-embed-dim"
              )
          if args.decoder_embed_path and (
              args.decoder_embed_path != args.encoder_embed_path
          ):
              raise ValueError(
                  "--share-all-embeddings not compatible with --decoder-embed-path"
              )
          encoder_embed_tokens = build_embedding(
              src_dict, args.encoder_embed_dim, args.encoder_embed_path
          )
          decoder_embed_tokens = encoder_embed_tokens
          args.share_decoder_input_output_embed = True
      else:
          encoder_embed_tokens = build_embedding(
              src_dict, args.encoder_embed_dim, args.encoder_embed_path
          )
          decoder_embed_tokens = build_embedding(
              tgt_dict, args.decoder_embed_dim, args.decoder_embed_path
          )
  
      encoder = cls.build_encoder(args, src_dict, encoder_embed_tokens)
      decoder = cls.build_decoder(args, tgt_dict, decoder_embed_tokens)
      return TwoPhaseTransformerModel(encoder, decoder)
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import options, utils
  from fairseq.models import FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture
  from fairseq.models.transformer import Embedding, Linear, TransformerDecoder, TransformerEncoder
  from fairseq.modules import AdaptiveSoftmax, LayerNorm, MultiheadAttention, PositionalEmbedding, SinusoidalPositionalEmbedding
label_desc: Use image node_id 3 for calling the TwoPhaseTransformerModel obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: TwoPhaseTransformerModel, emb