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."""
      base_architecture(args)
      # set default value for old checkpoints
      args.left_pad_source = getattr(args, "left_pad_source", False)
      if pytorch_translate_data.is_multilingual_many_to_one(args):
          return RNNModel.build_model_multilingual(args, task)
      src_dict, dst_dict = (
          task.source_dictionary,
          task.target_dictionary,
      )
  
      (
          encoder_embed_tokens,
          decoder_embed_tokens,
      ) = RNNModel.build_embed_tokens(args, src_dict, dst_dict)
      encoder = RNNModel.build_encoder(
          args, src_dict, embed_tokens=encoder_embed_tokens
      )
      decoder = RNNModel.build_decoder(
          args, src_dict, dst_dict, embed_tokens=decoder_embed_tokens
      )
      return cls(task, encoder, decoder)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.onnx.operators
  from fairseq import options, utils
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.modules import AdaptiveSoftmax
  from pytorch_translate import attention, rnn_cell, utils, vocab_reduction
  from pytorch_translate.common_layers import ContextEmbedding, DecoderWithOutputProjection, Embedding, Linear, RNNLayer, VariableTracker
  from pytorch_translate.data import data
  from pytorch_translate.multi_model import MultiDecoder, MultiEncoder
  from pytorch_translate.multilingual import MultilingualDecoder, MultilingualEncoder
  from pytorch_translate.ngram import NGramDecoder
  from pytorch_translate.semi_supervised import SemiSupervisedModel
  from pytorch_translate.utils import maybe_cat, maybe_cuda, torch_find
  from torch.nn.utils.rnn import pack_padded_sequence, PackedSequence, pad_packed_sequence
label_desc: Use image node_id 8 for calling the RNNModel obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: cls, RNNModel