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
      base_enc_dec_architecture(args)
      if args.pretrained_mlm_checkpoint:
          arg_overrides = None
          if args.hack_layernorm_embedding:
              arg_overrides = {"layernorm_embedding": False}
          loaded = (
              fairseq.checkpoint_utils.load_model_ensemble_and_task(
                  [args.pretrained_mlm_checkpoint],
                  arg_overrides=arg_overrides,
              )
          )
          ([roberta_enc], _cfg, _task) = loaded
      else:
          # Do we need to edit untie_weights here ?
          share_in_out = (
              args.share_decoder_input_output_embed
              or args.share_all_embeddings
          )
          args.untie_weights_roberta = not share_in_out
          if args.hack_layernorm_embedding:
              args.layernorm_embedding = False
              args.encoder_normalize_before = False
          roberta_enc = roberta.RobertaModel.build_model(args, task)
  
      return cls.from_roberta(roberta_enc, args, task.source_dictionary)
  
file_path: fairseq/fairseq/models/roberta/enc_dec.py
imports: import argparse
  import logging
  import torch.nn
  import fairseq.checkpoint_utils
  from fairseq.models import FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.transformer import TransformerDecoder
  from fairseq.models.roberta import model
label_desc: Use image node_id 2 for calling the RobertaEncDecModel obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: cls