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."""
  
      from omegaconf import OmegaConf
  
      if OmegaConf.is_config(args):
          OmegaConf.set_struct(args, False)
  
      # make sure all arguments are present
      base_architecture(args)
  
      if not safe_hasattr(args, "max_positions"):
          if not safe_hasattr(args, "tokens_per_sample"):
              args.tokens_per_sample = task.max_positions()
          args.max_positions = args.tokens_per_sample
  
      encoder = RobertaEncoder(args, task.source_dictionary)
  
      if OmegaConf.is_config(args):
          OmegaConf.set_struct(args, True)
  
      return cls(args, encoder)
  
imports: import logging
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import utils
  from fairseq.models import FairseqEncoder, FairseqEncoderModel, register_model, register_model_architecture
  from fairseq.models.transformer import DEFAULT_MIN_PARAMS_TO_WRAP, TransformerEncoder
  from fairseq.modules import LayerNorm
  from fairseq.modules.quant_noise import quant_noise
  from fairseq.modules.transformer_sentence_encoder import init_bert_params
  from fairseq.utils import safe_getattr, safe_hasattr
  from .hub_interface import RobertaHubInterface
label_desc: Use image node_id 4 for calling the RobertaModel obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: cls