code: def build_or_load_gen_model(args):
      config_class, model_class, tokenizer_class = MODEL_CLASSES[
          args.model_type
      ]
      config = config_class.from_pretrained(
          args.config_name
          if args.config_name
          else args.model_name_or_path
      )
      tokenizer = tokenizer_class.from_pretrained(args.tokenizer_name)
      if args.model_type == "roberta":
          encoder = model_class.from_pretrained(
              args.model_name_or_path, config=config
          )
          decoder_layer = nn.TransformerDecoderLayer(
              d_model=config.hidden_size,
              nhead=config.num_attention_heads,
          )
          decoder = nn.TransformerDecoder(decoder_layer, num_layers=6)
          model = Seq2Seq(
              encoder=encoder,
              decoder=decoder,
              config=config,
              beam_size=args.beam_size,
              max_length=args.max_target_length,
              sos_id=tokenizer.cls_token_id,
              eos_id=tokenizer.sep_token_id,
          )
      else:
          model = model_class.from_pretrained(args.model_name_or_path)
  
      logger.info(
          "Finish loading model [%s] from %s",
          get_model_size(model),
          args.model_name_or_path,
      )
  
      if args.load_model_path is not None:
          logger.info(
              "Reload model from {}".format(args.load_model_path)
          )
          model.load_state_dict(torch.load(args.load_model_path))
  
      return config, model, tokenizer
  
imports: import torch
  import torch.nn
  import numpy
  from transformers import RobertaConfig, RobertaModel, RobertaTokenizer, BartConfig, BartForConditionalGeneration, BartTokenizer, T5Config, T5ForConditionalGeneration, T5Tokenizer
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: build_or_load_gen_model(args) and returns: config,  model,  tokenizer