class_docstr: An architecture combining hybrid Transformer/RNN with character-based
  inputs (token embeddings created via character-input CNN) and outputs.
  This model is very similar to https://arxiv.org/pdf/1809.02223.pdf.
class_docstr_tok: ["An","architecture","combining","hybrid","Transformer\/RNN","with","character-based","inputs","(","token","embeddings","created","via","character-input","CNN",")","and","outputs",".","This","model","is","very","similar","to","https",":","\/\/arxiv.org\/pdf\/1809.02223.pdf","."]
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."""
      src_dict, dst_dict = (
          task.source_dictionary,
          task.target_dictionary,
      )
      base_architecture(args)
  
      assert hasattr(args, "char_source_dict_size"), (
          "args.char_source_dict_size required. "
          "should be set by load_binarized_dataset()"
      )
      assert hasattr(args, "char_target_dict_size"), (
          "args.char_target_dict_size required. "
          "should be set by load_binarized_dataset()"
      )
  
      assert hasattr(
          args, "char_cnn_params"
      ), "Only char CNN is supported for the char encoder hybrid model"
  
      args.embed_bytes = getattr(args, "embed_bytes", False)
  
      # In case use_pretrained_weights is true, verify the model params
      # are correctly set
      if args.embed_bytes and getattr(
          args, "use_pretrained_weights", False
      ):
          char_source_model.verify_pretrain_params(args)
  
      encoder = char_source_hybrid.CharSourceHybridModel.build_encoder(
          args=args, src_dict=src_dict
      )
      decoder = CharAwareHybridModel.build_decoder(
          args=args, src_dict=src_dict, dst_dict=dst_dict
      )
  
      return cls(task, encoder, decoder)
  
imports: import math
  from ast import literal_eval
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq.models import register_model, register_model_architecture
  from pytorch_translate import char_encoder, char_source_hybrid, char_source_model, hybrid_transformer_rnn, transformer, vocab_constants
  from pytorch_translate.data.dictionary import TAGS
  from pytorch_translate.utils import maybe_cuda
label_desc: Use image node_id 2 for calling the CharAwareHybridModel obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: cls